Re: C++: conditional static data member possible?
- From: Carlos Moreno <moreno_at_mochima_dot_com@xxxxxxxxxxxxxx>
- Date: Fri, 24 Nov 2006 17:35:53 -0500
loic-dev@xxxxxxx wrote:
Perhaps my idea is too simplistic. But why you don't just extend the
flag as follows:
- in the constructor of the static object, flag is set the
'NotInstancied'.
- in the constructor constructor of object A, flag is set to
'Instancied'.
- in the given method of class A corresponding to the action to
execute, flag is set to 'Done'
Then, in the destructor of the static object, you react depending on
the flag value:
This is exactly what I'm doing now!! The detail that this does not
solve is that I want to enforce or not the given action depending on
whether class A *appears* in the code, not depending on whether an
object of class A is actually instantiated at runtime.
That's why my example with a declaration of A inside a block scope
that never gets executed --- in that example, no object of class A
is ever instantiated, yet I wanted the condition to be enforced
(meaning, I want an error to be reported by the end of the
application).
Thanks,
Carlos
--
.
- References:
- C++: conditional static data member possible?
- From: Carlos Moreno
- Re: C++: conditional static data member possible?
- From: loic-dev
- C++: conditional static data member possible?
- Prev by Date: Re: C++: conditional static data member possible?
- Next by Date: Re: C++: conditional static data member possible?
- Previous by thread: Re: C++: conditional static data member possible?
- Next by thread: Re: C++: conditional static data member possible?
- Index(es):
Relevant Pages
|