|
Getting address of enclosing object from address of inner object Hi to all, my problem is the following: let's suppose I have a pointer to an object which I'm sure is enclosed in another object. Is it possible (safely) with some pointer arithmetics to get the address of the enclosing object? Obviously without passing a "back pointer" to the constructor of the inner object..... 21 Apr 2008 17:21
ADL woes Hi all, I have a problem overloading a function located in a namespace for a custom type. I have constructed the following example (emulating a preprocessed source file) exhibiting the problem. Although I tried to be concise with it, it's still quite long, so please bear with me: ---------------------------... 19 Apr 2008 19:29
composition and bad_alloc Hi all, This seems straightforward but gives this runtime error: terminate called after throwing an instance of 'std::bad_alloc' , what() : std9bad_alloc . I have: class X { int sz; T *ptr; public: X(int s, T *p) : sz(s), ptr(new T[s]) { assert(ptr != NU... 18 Apr 2008 16:38
How to pass enum as default argument I am having an issue with passing an enum as a default argument to a class method. I have a class similar to enum Method { a, b }; class A{ A(); void MyMethod(int i, Method m = a){ ... } } The compiler error I get says error: default argument for 'Method m' has type '<unknown type>' ... 17 Apr 2008 05:10
Please consider this addition for tuples in c++0x Hello. I would like to propose a small addition to the tuple class template in c++0x. I'm surprised I didn't see this in any proposal, since it's gonna give us more than a headache (I think) if it's not included. Since the tuple class template is a container, it would be very useful to be able to loop over each e... 17 Apr 2008 13:20
Filestream problems I'm writing a program in which I read text from a file, store all of the words into a binary search tree, and then print the words out to the screen in order from that tree. For some reason, opening and using an input filestream is causing problems for my binary tree functions. When I try to use them together, m... 17 Apr 2008 20:31
Differentiating pimpl idiom classes in c++ What are good strategies for selecting, either at run-time or compile time, various pimpl'ed implementations? Also, retaining the ability to switch implementations without recompiling. Boost has an example but with only one implementation class: (what would an example with 2 implementation classes look like?) ... 21 Apr 2008 21:21
boost variant template type argument count I'm using an instance of the boost::variant type as the token value of a non-trivial grammar. The type list is 24 items long. Apparently there is a type list limit of 20 items. Is this correct? Is this just a matter of building the cases, or is it dictated by some platform limit on template type arguments? (Is i... 16 Apr 2008 13:13
copy constructor not being called Hi In the following code, I expect the copy constructor to be called as per the textbooks but it is not being called. Could you please tell me why? g++ version 4.1.2 # include <iostream> using namespace std; class base { char s; public: base( ){cout<< "construction" << endl;} base(const char a )... 17 Apr 2008 05:10
How to declare the type in the class? Hi, my problem below: //1.h class A { public: enum B{a,b,c}; }; //2.h how to declare enum B? class C { public: void func(A::B m); }; Thank you very much! -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time pos... 16 Apr 2008 13:13 |