Repeat a typedef or include a header with the typedef? Suppose I have the following: (in class_a.h): class Foo; class ClassA { public: typedef std::vector< boost::shared_ptr<Foo> > Foos; Foos makeFoos() const; }; and in another class, I have a method that makes use of a vector of Foos. Should I do this: (Try #1, class_b.h): #include "clas... 22 Feb 2010 10:42
Shall I use mutable or const_cast or remove const? Hi, I have some trouble understanding the true meaning of const. Please consider this example. class Store { public: void add( int* item ) { /* ... */ } }; class Item { public: Item( int item ) : item_(item) {} void giveToStore( Store& store ) const { store.add( &item_ ); } private: ... 27 Feb 2010 23:09
UML Survey I am currently conducting a study that focuses primarily on how programmers work with UML specifications. I would like to invite members to participate. I also encourage members to distribute the link to this survey to anyone (in your organization or others in the field) that has some familiarity with UML and woul... 18 Feb 2010 03:57
c++0x: u16string u32string and string Hello. I've been trying support for utf strings in c++0x (from gcc svn). I looked at the current draft N3000 for the language, and I have a question. The length() member function says it returns the number of char16_t, char32_t or chars in a string, depending on the basic character type. But the number of char... 17 Feb 2010 21:19
GPP Generic Preprocessor Is there an active user group for the GPP preprocessor anywhere? It seems possibly a good tool for creating highly repetitive blocks of assembler code, but there doesn't seem to be much documentation, and I can't find much discussion of it since 2004. If you know anything about GPP, or if you use it, or if you know... 17 Feb 2010 21:19
3.8.7 Object lifetime example (N3000) Hi, I am slightly worried by the example in 3.8.7, specifically the following line: new (this) C(other); // new object of type C created Although not the case in this example if C's copy constructor could throw an exception a destructor could be erroneously called (destruction of c1 in the example during st... 22 Feb 2010 15:16
Why does inserter need Iterator template parameter The inserter function (from msdn): template<class Container, class Iterator> insert_iterator<Container> inserter( Container& _Cont, Iterator _It ); It returns an object of insert_iterator. Can't iterator type be obtained from Container type? Something like: template<class Con... 17 Feb 2010 11:03
Detecting when a function in a CRTP base class is hidden Hello all, I am using CRTP (the Curiously Recurring Template Pattern) like so: template<T> struct base { void do_something() { prepare(); static_cast<T*>(this)->hide_me(); finalize(); } void hide_me() {} }; struct derived : base<derived> { void hide_me() { /* do some... 17 Feb 2010 02:11
Detecting when a function in a CRTP base class is hidden Cory Nelson wrote: Hello all, I am using CRTP (the Curiously Recurring Template Pattern) like so: template<T> struct base { void do_something() { prepare(); static_cast<T*>(this)->hide_me(); finalize(); } void hide_me() {} }; struct ... 17 Feb 2010 00:02
Why does inserter need Iterator template parameter Kris Prad wrote: The inserter function (from msdn): template<class Container, class Iterator> insert_iterator<Container> inserter( Container& _Cont, Iterator _It ); It returns an object of insert_iterator. Can't iterator type be obtained from Container type? ... 17 Feb 2010 00:02 |