Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
2
Posts with Upvotes
2
Upvoting Members
2
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
2 Endorsements
Ranked #621
~6K People Reached
Favorite Forums
Favorite Tags
Member Avatar for trantran

I am reading the (otherwise excellent) The C++ Programming Language (4th edition - Hardcover) (Stroustrup) and I cannot understand about 4 pages of it despite a lot of attention to it. It's section 27.4.1 Composing Data Structures starting page 767. After reviewing obviously unsatisfactory alternatives on page 767 for a …

Member Avatar for trantran
0
795
Member Avatar for trantran

I am writing a class that uses different policies stored in classes I want to declare this class by simply selecting the policies by writing `my_great_class<policy45, policy22, policy12>` (There can be a varying number of policies) which would translate automatically into: struct empty_class{}; struct policy12: empty_class{ // code... }; struct …

Member Avatar for trantran
0
599
Member Avatar for trantran

I want to optimize a directory listing input iterator so that the WIN32_FIND_DATA can be written directly to a vector (via emplace) instead of being first written inside the iterator. This is an idea of the code: /* std::vector<WIN32_FIND_DATA> vwfd; struct listing_it:std::iterator<std::input_iterator_tag, WIN32_FIND_DATA>{ HANDLE handle; WIN32_FIND_DATA wfd; auto operator*()->wfd&{return *wfd;} …

Member Avatar for mike_2000_17
0
177
Member Avatar for trantran

I have been programming in Windows with C++ and I am tiptoeing linux (mainly because of its most up-to-date C++ and also because of it's open source). I want to do multi-platform programming. The programming part is easy: I don't need help there. The part I need help is in …

Member Avatar for trantran
1
297
Member Avatar for trantran

I am trying to have a C++11 compiler that works. It seems (if the publicity is right... and typically it never usually is!) that gnu g++ 4.8 might be it. So I installed Ubuntu 12.04 read the instruction on multiple sites, did EXACTLY as it was said, got (obviously) errors, …

Member Avatar for trantran
0
433
Member Avatar for trantran

I want to create an arrays pointing to the members of an object, something like this: // der1, der2, der3 or derived object of base class myobject{ der1 * d1; der2 * d2 der3 * d3 void do_op(){ *d3=*d1 + *d2;} // this must remain as time-efficient as possible typedef …

Member Avatar for kresimir
0
107
Member Avatar for trantran

I am thinking of writing a path_name_class that would be easily adaptable to any file system, but I have run in this difficulty: it appears that some file systems allow **ALL unicode except null** characters in their directory entry (this is the case for example for exfat and many others …

Member Avatar for trantran
0
188
Member Avatar for trantran

I am finding that variadic templates are quite useful for typesafety of functions with variable length of argments, but I am having much less success using then with struct especially with typelists. Is it possible to 1) count 2) extract types in/from a typelist using variadic templates. I tried with …

Member Avatar for trantran
0
748
Member Avatar for trantran

Here is my problem: 1) I have a tree which I want to act upon some branches indepedantly and simultaneously by different threads 2) The program is structured so that the processing of each branch is isolated after the main "manager" thread delegates the work to different thread: memory of …

Member Avatar for jmichae3
0
299
Member Avatar for trantran

I am reading Exceptional C++ (Herb Sutter) and there is something that I don't get at all concerning vector insertion. On page 59 it says: 1) "multi-elements inserts ("iterator range" inserts) are never strongly exception-safe" 2) "for vector<T>.... inserts and erases (whether single- or multi-elements) are strongly exception-save as long …

Member Avatar for trantran
0
375
Member Avatar for trantran

Why is this possible (in VS2009): [CODE] struct outer{ struct inner1{ void f(){ inner2 in2; in2.g(); /* no previous forward declaraction*/ } }; struct inner2{ void g(){} } }; [/CODE] ... but not this (???) [CODE] struct outer{ /* This line required to remove error: struct inner2; */ struct inner1{ …

Member Avatar for trantran
0
178
Member Avatar for trantran

This is a frustating problem likely experienced by everyone and therefore there (might) be now a "perfect" solution, but my limited skills have impeded me from finding it. 1) I created a plain vanilla text_class that automatically relocates itself when needed. 2) I want to use my text_class with Win32 …

Member Avatar for mike_2000_17
0
99
Member Avatar for trantran

It seems easy to make sure that an object can only be created on the stack and not on the heap (by simply marking private operator new), but is it possible to do the opposite: only permitting the creation of an object on the heap (with operator new) and *not* …

Member Avatar for mike_2000_17
0
152
Member Avatar for trantran

[CODE] class C{ friend class F; private: fct1(){} fct2(){} fct3(){} public: fct_for_everyone(){} }; class F{ }; [/CODE] F is a friend of C, so it has access to fct1,fct2,fct3. But in real life, friendship has limits! You don't want to reveal everything! So is there a way in C++ to …

Member Avatar for mike_2000_17
0
156
Member Avatar for trantran

[CODE] struct S{ int i; double d; S(const S & incoming_S):i(S.i),d(S.d){} }; void test(){ S myS=S( /*temporary variable*/ S(23,3.14) ); } [/CODE] Questions: 1) During initialisation, is the temporary variable S(23,3.14) actually created or can it (and is it actually for typical compilers such as VS2008) optimised away? 2) Same …

Member Avatar for trantran
0
173
Member Avatar for trantran

I have a C++ standard related question. Let's say I have 2 derived object D1 and D2 (which may contain class D virtual functions) of an identical class base B. Now, I create base pointers bpD1 and bpD2 to those objects. 1) Are bpD1 and bpD2 *guaranteed* to be different …

Member Avatar for trantran
0
184
Member Avatar for trantran

Is there a safe and legal way to go from a pointer to a member of an object to a pointer to that same object?

Member Avatar for trantran
0
128
Member Avatar for trantran

I want to filter the global operator new and operator delete. For example, this could be used to count the number of times they are called and check at the end of a program to see if they match for memory leak detection or other purposes. I do know perfectly …

0
62
Member Avatar for trantran

I've look in the C++ standard and, when listing list of compound stuff, it does not mention anything like "pointer to [B]data [/B]member of an instantiated class". So the question is: [CODE]struct test{ int a; double d; ..... //more complicated stuff here to make it a NON-pod structure) .... }; …

Member Avatar for trantran
0
119
Member Avatar for trantran

This is likely a stupid question, but I can't figured out by myself how to pass a pointer to a member function of a templatised class in its own template parameters. More clearly: I would like to have this to work out: [code]template <typename T, T test::* PtrToMember> class test{ …

Member Avatar for trantran
1
555