Are you a C++ guru - prove it here !

I'm having problems with the following code below from boost/serialization/export.hpp compiling BOOST_CLASS_EXPORT_GUID(final, "final") results in the following error message on the gcc compilers. error: too few template-parameter-lists VC compilers don't complain about this. I've tried replacing ::boost::archive::detail::init_guid< T >::guid_initializer = \ with ::boost::archive::detail::init_guid< T >::guid_initializer< T> =\ But this doesn't help. Happy to get help from any C++ guru Robert Ramey template<typename T> class init_guid { static ::boost::archive::detail::guid_initializer<T> const & guid_initializer; }; } // namespace detail } // namespace archive } // namespace boost #define BOOST_CLASS_EXPORT_GUID(T, K) \ ::boost::archive::detail::guid_initializer< T > const & \ ::boost::archive::detail::init_guid< T >::guid_initializer = \ ::boost::serialization::singleton< \ ::boost::archive::detail::guid_initializer< T > \
::get_mutable_instance().export_guid(K); \

On Wed, 14 Jan 2009 20:02:22 -0800 "Robert Ramey" <ramey@rrsd.com> wrote:
I'm having problems with the following code below from boost/serialization/export.hpp
compiling
BOOST_CLASS_EXPORT_GUID(final, "final")
results in the following error message on the gcc compilers.
error: too few template-parameter-lists
VC compilers don't complain about this. I've tried replacing
::boost::archive::detail::init_guid< T >::guid_initializer = \
with
::boost::archive::detail::init_guid< T >::guid_initializer< T> =\
But this doesn't help. Happy to get help from any C++ guru
Robert Ramey
template<typename T> class init_guid { static ::boost::archive::detail::guid_initializer<T> const & guid_initializer; }; } // namespace detail } // namespace archive } // namespace boost
#define BOOST_CLASS_EXPORT_GUID(T, K) \ ::boost::archive::detail::guid_initializer< T > const & \ ::boost::archive::detail::init_guid< T >::guid_initializer = \ ::boost::serialization::singleton< \ ::boost::archive::detail::guid_initializer< T > \
::get_mutable_instance().export_guid(K); \
#define BOOST_CLASS_EXPORT_GUID(T, K) \ template <typename T> \ ::boost::archive::detail::guid_initializer< T > const & \ ::boost::archive::detail::init_guid< T >::guid_initializer = \ ::boost::serialization::singleton< \ ::boost::archive::detail::guid_initializer< T > \
::get_mutable_instance().export_guid(K);
Simple oversight - you're missing the obvious: template <typename T> \ at the beginning of your macro. Cheers, -- Manfred 15 January, 2009

AMDG Robert Ramey wrote:
I'm having problems with the following code below from boost/serialization/export.hpp
compiling
BOOST_CLASS_EXPORT_GUID(final, "final")
results in the following error message on the gcc compilers.
error: too few template-parameter-lists
VC compilers don't complain about this. I've tried replacing
::boost::archive::detail::init_guid< T >::guid_initializer = \
with
::boost::archive::detail::init_guid< T >::guid_initializer< T> =\
But this doesn't help. Happy to get help from any C++ guru
As it happens, I've just been testing a solution. Patch against the trunk attached. In Christ, Steven Watanabe

Congratulations - You're a certified C++ guru. Robert Ramey Steven Watanabe wrote:
AMDG
Robert Ramey wrote:
I'm having problems with the following code below from boost/serialization/export.hpp
compiling
BOOST_CLASS_EXPORT_GUID(final, "final")
results in the following error message on the gcc compilers.
error: too few template-parameter-lists
VC compilers don't complain about this. I've tried replacing
boost::archive::detail::init_guid< T >::guid_initializer = \
with
boost::archive::detail::init_guid< T >::guid_initializer< T> =\
But this doesn't help. Happy to get help from any C++ guru
As it happens, I've just been testing a solution. Patch against the trunk attached.
In Christ, Steven Watanabe
Index: boost/serialization/export.hpp =================================================================== --- boost/serialization/export.hpp (revision 50600) +++ boost/serialization/export.hpp (working copy) @@ -146,22 +146,25 @@ } };
-template<typename T> -class init_guid { - static ::boost::archive::detail::guid_initializer<T> const - & guid_initializer; -}; - } // namespace detail } // namespace archive } // namespace boost
#define BOOST_CLASS_EXPORT_GUID(T, K) \ + namespace boost_archive_export_initializer_impl { \ + template<typename T0> \ + struct init_guid; \ + template<> \ + struct init_guid< T > { \ + static ::boost::archive::detail::guid_initializer< T > const \ + & guid_initializer; \ + }; \ ::boost::archive::detail::guid_initializer< T > const & \ - ::boost::archive::detail::init_guid<T>::guid_initializer = \ + init_guid< T >::guid_initializer = \ ::boost::serialization::singleton< \ ::boost::archive::detail::guid_initializer< T > \ >::get_mutable_instance().export_guid(K); \ + }
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (3)
-
Manfred Doudar
-
Robert Ramey
-
Steven Watanabe