First  |  Prev |  Next  |  Last
Pages: 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Error value translation idiom
Hi, I'm in the process of redesigning a library for handling traditional error values in C and legacy C++ code. I would very much appreciate comments on the merits and possible implementation problems with the approach outlined below. * Rationale and overview Error values without exception handling breaks comp... 10 Apr 2008 16:55
a compiler error in template function default argument value
Hi, all. I encounter a compiler error in gcc 3.4. Is there anyone encounter the some situation. And why ??? ///////////////////////////////////// #include <iostream> using namespace std; #define INT_ID 1 #define FLOAT_ID 2 #define CHAR_ID 3 template<int tid> struct Tid2T{}; #define TID2T_HELPER(id, t... 10 Apr 2008 22:08
typename keyword
I have a basic question about the keyword 'typename'. typename has to be used whenever a name that depends on a template parameter is a type. But in the function foo() below I am using vector<int>::const_iterator without typename. How does this work? How does the compiler know that const_iterator is not a static... 10 Apr 2008 22:08
virtualand nonvirtual templateness"
I am bit confused as to whether the following is allowed; why and why not: 1) template<typename T> class Foo{ .... virtual TsomeOp(); }; 2) template<typename T> class Foo{ .... template<typename K> virtual T someOp(K k); }; 3) class Foo{ .... template<typename K> virtual T some... 11 Apr 2008 16:42
std::complex and extensible literals.
Hello. I have not seen a propsal like this, which I think is quite logical. The proposal does not break the standard layout for complex, I think. What do you think of this improvement? I have omitted rvalue references and overloads, but you get the idea: namespace std { template <class T> class imaginary { ... 11 Apr 2008 12:41
User defined copy constructors
Hi, I need to create copy constructors for a lot of my types in order to fix the common pointer problems of shallow copying. I've never thought much about it before but I've checked out the most common tutorials and they seem to suggest what I've used in the past, namely: class X { public: X( const X& a_Other... 11 Apr 2008 12:41
templated virtual functions??
Hi Let say that I wanted to do a filesystem browser. The filesystem is a tree structure, so my idea was to make an general tree browser that could browse anything that implemented the ITreeStructure interface. Now I want to make a generic container class that is a tree and can hold any data type. The declarations... 9 Apr 2008 19:35
Reusing user data block in (de)allocator
I guess a fairly standard trick when implementing a custom free-list allocator is to re-use the start of the user-data block for the "next" pointer of the free list. This could look something like the following template<typename T> void allocator<T>::deallocate(void* userData) { // Assume T is big enough for... 13 Apr 2008 14:19
Class & Instance thereof having same Name.
Consider the following code snippet: .... class XXXX { public: XXXX() { cout << " XXXX Constructor " << endl; }; int i; }; class YYYY { public: YYYY() ... 9 Apr 2008 14:39
Swappable concepts and ADL
[ Sorry for my delayed response -- I was at the ACCU conference! ] Alberto Ganesh Barbati wrote: Someone suggested this idiom: using std::swap; swap(x, y); which does the right thing in all cases, but, frankly... it sucks! I'd rather call it a clever trick :-) BTW, the idiom is recommended b... 16 Apr 2008 13:13
First  |  Prev |  Next  |  Last
Pages: 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28