Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-01-15 14:29:56


Nat Goodspeed wrote:
> My one additional comment on design: people are very used to writing
> my_singleton::instance()->member. I like the coolness of writing
> my_singleton::instance->member instead, but I suspect I'll hear some
> grumbling from colleagues who keep getting reminded by compile errors. I
> wish it were possible to provide 'instance' as both a static data member
> and a static member function...
> But I'd be good with having this become the new convention.
>

It's actually easy, although I don't think it's a good idea:

class instance_t {
    T* operator->() const;
    T* operator()() const;
};

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net