In this contrived example, I have a static initialization function that is run at construction time.
I'd like to know if this a legal way to initialize a_, b_, and c_. Or, is it too early in the construction process to use them this way?
DWORD SomeInitializationFunction( HANDLE*, DWORD*, DWORD* );
class MyClass
{
public:
MyClass() : m_( MyClass::Create( &a_, &b_, &c_ ), &::CloseHandle )
{
};
private:
static HANDLE Create( DWORD* a, DWORD* b, DWORD* c )
{
DWORD a1, b1;
HANDLE h;
*c = ::SomeInitializationFunction( &h, &a1, &b1 );
if( *c == 0 )
{
*a = a1;
*b = b1;
return h;
}
return NULL;
};
boost::shared_ptr< void > m_;
DWORD a_;
DWORD b_;
DWORD c_;
};
Thanks, PaulH