Compile time hooks, like: AClass<SomeType,Hooks<FunctorOne,FunctorTwo,...> > Hi, how to implement compile time hook mechanism? An use case would look like: AClass<SomeType,Hooks<FunctorOne,FunctorTwo,...>> aobj; AClass::AFunction() { // ... RunHooks(); // ... } Thanks, Muggar -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.... 4 Feb 2010 16:49
Why you should never use a const& parameter to initialize a const& member variable! On Feb 3, 3:49 pm, "Martin B." <0xCDCDC...(a)gmx.at> wrote: myFAQ 0815 - Why you should never use a const& parameter to initialize a const& member variable! Today, once again, I shot myself in the foot. I thought I'd share this. Rule: You must never use a const-reference parameter to a constructor to ... 8 Feb 2010 08:51
vector question Hi, I'm thinking about changing some of my arrays of structures to vectors, but it seems like it might be quite a bit slower. Can anybody shed some light on the following example? With the array method, when I want to add to the FooList, I call GetNextFoo() which returns a pointer, and I can just fill in my foo ... 5 Feb 2010 15:03
Function lookup as metaprogramming I would like to have several classes which do the following: - HasSymbol<T>::value is true iff T has a symbol called f - HasFunction<T>::value is true iff T has a function called f - HasFunctionWithReturnType<T, S>::value is true iff T has a function called f which returns T - HasFunctionWithThreeParams<T>::value ... 5 Mar 2010 15:03
Providing Haskell like newtype for C++ First, for those that do not know Haskell, it suffices to say that newtype is similar to C++ typedef with one difference. The difference is that the new type is not just an alias for the oold type, but a completely different type that just happens to share the semantics (i.e. one cannot implicitly convert between t... 4 Feb 2010 16:49
Exception Specification Compromise The debate about dynamically or statically checked exceptions will never end. Still, I would like to propose a compromise. Can we have a flag in the compiler that, when set, will do a static check for throw(), i.e. no-throw functions? That would help a lot when trying to write exception safe code with guarante... 15 Feb 2010 18:53
set::find with custom equality operator== Hi all, I have the following code. // db_operators.h #ifndef INCLUDED_DB_OPERATORS #define INCLUDED_DB_OPERATORS #include <cstring> struct ecodb2{ unsigned long long id; char code[21]; }; inline bool operator==(const ecodb2& lhs, const ecodb2& rhs) { std::cout <<... 3 Feb 2010 12:49
constructor declaration ended with comma - is this a valid C++ syntax On 2 Feb., 21:23, pion <vahan...(a)poczta.onet.pl> wrote: Can anyone answer if this is a valid C++ syntax - look at constructors ended with comma - not semicolon: class Test { public: Test(), Test(int a), ~Test(); int getA() const; private: int a; }; F... 2 Feb 2010 21:56
auto_ptr of incomplete type not allowed? Hi, N3000 states that an incomplete type is allowed for shared_ptr and unique_ptr but it doesn't say the same for auto_ptr. Is this omission a mistake or deliberate? An incomplete type auto_ptr member variable should be allowed as long as parent class destructor is not declared inline. This is useful when i... 3 Feb 2010 12:49
Is it possible to determine if a class has a default ctor? Hi all, I was wondering if someone could help me with the program below. I'm trying to figure out if there is a way to determine if a particular class has a default constructor, copy constructor and destructor. I know how to use the SFINAE trick to determine if a class supports a particular operator or not (see ... 3 Feb 2010 10:32 |