how to non-default construct with multiple virtual inheritance?? Hello, how to write a non-default constructor for a class that inherits an indirect base class, with multiple intermediate classes that list the base as virtual? In the SSCCE below, the compiler complains "error: no matching function for call to �Base::Base()". Thank you, Mark class Base { public: Bas... 4 Jun 2010 10:18
Container adapter to treat a sorted vector as a set Hi, I'd like to be able to use a sorted vector as a set (or map) with a parametrized (template) function that expects a set (or map) interface. The function only calls find, not insert or erase. I thought that this could be accomplished using a container adapter. Does this seem like a good approach? Cheers, ... 8 Jun 2010 05:49
Throwing error is potentially buggy >From a different site, a programmer asked for proper coding standard (error handling) for a common program scenario: initialize(); while (true) { Message msg,out; receive(msg); process(msg,out); send(out); } I thought it would be very difficult to throw std::exception classes to handle al... 8 Jun 2010 13:41
Can there be parallel initialization of global variables in C++0x? On 1 June, 21:33, "Peter C. Chapin" <pcc482...(a)gmail.com> wrote: Nick Hounsome wrote: It seems to me that you still have to wait for everyting to be initialized before main (unless the compiler adds a whole lot of extra overhead or you are prepared to break things) so unless the compiler somehow ... 2 Jun 2010 09:48
Names or traits for std::random param_type access methods? Are there trait definitions and common names for the param_type access methods of std::random (i.e., #include <random>)? The distribution- specific names are sensible, but is there introspection support? Each distribution template defines a struct param_type { ... }, as well as access methods. Access methods ar... 2 Jun 2010 09:48
Temporaries passed to constructor yield invalid member references > The difference is that you can pass a temporary as a const-ref without seeing it, while you cannot pass a temporary as a pointer without some syntactic overhead. (This statement does *only* apply to the immediate call - it does not apply to general lifetime management.) But lifetime management is a very i... 2 Jun 2010 09:48
Temporaries passed to constructor yield invalid member references Razvan Cojocaru wrote: Use a const pointer. Use it for the argument passing and if it's not too much hassle also use it for the member. Bottom line for me is: Always use pointers for these parameters. Use a pointer member in "90%" of cases. I don't see the difference between his problem using... 1 Jun 2010 13:04
About Stan Lippman Stan Lippman is a great author in C++. However he no longer has a hompage and there is no information about him currently on the web. Can anyone provide any information ? -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] ... 1 Jun 2010 13:04
std::memset, std::fill, hand-written for loop Hello, Are there any articles comparing the cases/reasons when/why to use memset vs fill, vs writing a loop by hand? Regards, -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] ... 10 Jun 2010 21:15
Temporaries passed to constructor yield invalid member references On May 30, 1:39 am, M Stefan <mstefa...(a)gmail.com> wrote: Hello. I am trying to write a class similar to this: template <class StringT> struct A { A (StringT const &str) : str(str) { } StringT const &str;}; The problem is that the constructor allows passing temporaries, which get destroye... 1 Jun 2010 16:23 |