--- ./boost/test/utils/trivial_singleton.hpp 2008-10-13 12:20:26.553306000 +0400 +++ ./boost/test/utils/trivial_singleton_fixed.hpp 2009-09-11 19:29:44.715794600 +0400 @@ -35,19 +35,51 @@ template class singleton : private boost::noncopyable { public: - static Derived& instance() { static Derived the_inst; return the_inst; } + static Derived& instance(); protected: singleton() {} ~singleton() {} }; -} // namespace unit_test + +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) +template< typename T > +T& get_static_instance() +{ + static T inst; + return inst; +} + +template +inline Derived& singleton< Derived >::instance() +{ + return get_static_instance< Derived >(); +} + +#define BOOST_TEST_SINGLETON_CONS( type ) \ +template< typename T > friend T& boost::unit_test::get_static_instance(); \ +type() {} \ +/**/ + +#else // BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) + +template +inline Derived& singleton< Derived >::instance() +{ + static Derived the_inst; + return the_inst; +} #define BOOST_TEST_SINGLETON_CONS( type ) \ friend class boost::unit_test::singleton; \ type() {} \ /**/ +#endif // BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) + +} // namespace unit_test + + #if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) #define BOOST_TEST_SINGLETON_INST( inst ) \