[serializaton] namespace issues with extended type info
If I nest macro calls such as: namespace SomeNamespace { BOOST_SERIALIZATION_ASSUME_ABSTRACT(SomeClass) BOOST_CLASS_TYPE_INFO(SomeClass, extended_type_info_no_rtti<SomeClass>) BOOST_CLASS_EXPORT(SomeClass) } inside the namespace containing the type I get a TON of compiler errors. The wackiest is that the compiler thinks boost is a namespace inside of my namespace. Things improve (not fully tested) if I move the macros outside of my namespace and qualify the type with namespace name: BOOST_SERIALIZATION_ASSUME_ABSTRACT(SomeNamespace::SomeClass) BOOST_CLASS_TYPE_INFO(SomeNamespace::SomeClass, extended_type_info_no_rtti<SomeNamespace::SomeClass>) BOOST_CLASS_EXPORT(SomeNamespace::SomeClass) Can someone explain please? Thanks
AMDG Daniel Roberts wrote:
If I nest macro calls such as:
namespace SomeNamespace { BOOST_SERIALIZATION_ASSUME_ABSTRACT(SomeClass) BOOST_CLASS_TYPE_INFO(SomeClass, extended_type_info_no_rtti<SomeClass>) BOOST_CLASS_EXPORT(SomeClass) }
inside the namespace containing the type I get a TON of compiler errors. The wackiest is that the compiler thinks boost is a namespace inside of my namespace.
Both BOOST_SERIALIZATION_ASSUME_ABSTRACT and BOOST_CLASS_TYPE_INFO specialize templates in namespace boost::serialization. Therefore they need to be placed in the global namespace.
Things improve (not fully tested) if I move the macros outside of my namespace and qualify the type with namespace name:
BOOST_SERIALIZATION_ASSUME_ABSTRACT(SomeNamespace::SomeClass) BOOST_CLASS_TYPE_INFO(SomeNamespace::SomeClass, extended_type_info_no_rtti<SomeNamespace::SomeClass>) BOOST_CLASS_EXPORT(SomeNamespace::SomeClass)
Can someone explain please?
In Christ, Steven Watanabe
All the macros that the serialization library defined are assumed to be invoked from the global namespace. Invoking them from any other namespace will fail. Robert Ramey "Daniel Roberts" <impulsionaudio@gmail.com> wrote in message news:14125aaf0901131529i5fc67c1dj651a350a07a6741b@mail.gmail.com... If I nest macro calls such as: namespace SomeNamespace { BOOST_SERIALIZATION_ASSUME_ABSTRACT(SomeClass) BOOST_CLASS_TYPE_INFO(SomeClass, extended_type_info_no_rtti<SomeClass>) BOOST_CLASS_EXPORT(SomeClass) } inside the namespace containing the type I get a TON of compiler errors. The wackiest is that the compiler thinks boost is a namespace inside of my namespace. Things improve (not fully tested) if I move the macros outside of my namespace and qualify the type with namespace name: BOOST_SERIALIZATION_ASSUME_ABSTRACT(SomeNamespace::SomeClass) BOOST_CLASS_TYPE_INFO(SomeNamespace::SomeClass, extended_type_info_no_rtti<SomeNamespace::SomeClass>) BOOST_CLASS_EXPORT(SomeNamespace::SomeClass) Can someone explain please? Thanks ------------------------------------------------------------------------------ _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Daniel Roberts
-
Robert Ramey
-
Steven Watanabe