- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
20 Posted Topics
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 … | |
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 … | |
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;} … | |
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 … | |
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, … | |
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 … | |
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 … | |
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 … | |
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 … ![]() | |
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 … | |
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{ … | |
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 … | |
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* … | |
[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 … | |
[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 … | |
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 … | |
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? | |
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 … | |
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) .... }; … | |
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{ … |
The End.