
David Abrahams wrote:
"Jonathan Turkanis" writes:
The reason I like the macros is that you only need one version of the code,
I consider the #ifdef idiom to be only "one version of the code", when I look at it. I generally don't need protected members, so I put the friends right between the public and private stuff, where it belongs:
class fu { public: . . . #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS private: // template friends template<class Y> friend class shared_ptr; template<class Y> friend class weak_ptr; #endif
private: // data members T* px; detail::shared_count pn; };
Clean and quiet.
I didn't realize macros were noisy. Looking at the interfaces library, which uses the macros extensively, I see that the main use comes in base class lists class derived : BOOST_IDL_PRIVATE base and in macros, which can't contain preprocessor directives. Maybe this device is less useful in non-macro-based libraries.
Just wait till you start needing nontype template parameters.
I didn't say it was a panacea.
It's basically the same idea as BOOST_USE_FACET.
Never had to use that one.
or BOOST_STATIC_CONSTANT. Jonathan