|
Boost : |
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2005-05-06 08:07:56
I'm a little confused about singleton usage. Can a singleton have a
constructor?
I tried this:
using boost::basic_singleton;
struct Example :
public basic_singleton<Example> {
Example() {
std::cout << "Hello\n";
}
int Cnt() const { return 0; }
};
int main() {
Example::pointer ptr;
std::cout << ptr->Cnt();
}
./Test1
0
It appears constructor wasn't run, because nothing was printed.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk