Skip to content

Commit

Permalink
added HPX_TRAITS_NONINTRUSIVE_POLYMORPHIC_TEMPLATE
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonBikineev committed Apr 24, 2015
1 parent 262a598 commit d4d983e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ namespace hpx { namespace serialization { namespace detail

#define HPX_SERIALIZATION_POLYMORPHIC_TEMPLATE(Class) \
HPX_SERIALIZATION_POLYMORPHIC_WITH_NAME( \
Class, util::type_id<Class>::typeid_.type_id();) \
Class, hpx::util::type_id<Class>::typeid_.type_id();) \
/**/

#define HPX_SERIALIZATION_POLYMORPHIC_TEMPLATE_SPLITTED(Class) \
HPX_SERIALIZATION_POLYMORPHIC_WITH_NAME_SPLITTED( \
Class, util::type_id<T>::typeid_.type_id();) \
Class, hpx::util::type_id<T>::typeid_.type_id();) \
/**/

#endif
22 changes: 16 additions & 6 deletions hpx/traits/polymorphic_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#ifndef HPX_TRAITS_POLYMORPHIC_TRAITS_HPP
#define HPX_TRAITS_POLYMORPHIC_TRAITS_HPP

#include <hpx/util/detail/pp_strip_parens.hpp>

#include <boost/mpl/bool.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/utility/enable_if.hpp>
Expand Down Expand Up @@ -55,12 +57,20 @@ namespace hpx { namespace traits {

}}

#define HPX_TRAITS_NONINTRUSIVE_POLYMORPHIC(Class) \
namespace hpx { namespace traits { \
template <> \
struct is_nonintrusive_polymorphic<Class>: \
boost::mpl::true_ {}; \
}} \
#define HPX_TRAITS_NONINTRUSIVE_POLYMORPHIC(Class) \
namespace hpx { namespace traits { \
template <> \
struct is_nonintrusive_polymorphic<Class>: \
boost::mpl::true_ {}; \
}} \
/**/

#define HPX_TRAITS_NONINTRUSIVE_POLYMORPHIC_TEMPLATE(TEMPLATE, ARG_LIST) \

This comment has been minimized.

Copy link
@sithhell

sithhell Apr 26, 2015

Member

Thanks!

namespace hpx { namespace traits { \
HPX_UTIL_STRIP(TEMPLATE) \
struct is_nonintrusive_polymorphic<HPX_UTIL_STRIP(ARG_LIST)> \
: boost::mpl::true_ {}; \
}} \
/**/

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ struct Base
std::string prefix_;
};

namespace hpx { namespace traits {
template <typename T>
struct is_nonintrusive_polymorphic<Base<T> >
: boost::mpl::true_ {};
}}
HPX_TRAITS_NONINTRUSIVE_POLYMORPHIC_TEMPLATE((template <class T>), Base<T>)

template <typename Archive, typename T>
void serialize(Archive & ar, Base<T> & b, unsigned)
Expand All @@ -60,11 +56,7 @@ struct Derived1 : Base<T>
std::size_t size_;
};

namespace hpx { namespace traits {
template <typename T>
struct is_nonintrusive_polymorphic<Derived1<T> >
: boost::mpl::true_ {};
}}
HPX_TRAITS_NONINTRUSIVE_POLYMORPHIC_TEMPLATE((template <class T>), Derived1<T>)

template <typename Archive, typename T>
void serialize(Archive & ar, Derived1<T> & d1, unsigned)
Expand Down

0 comments on commit d4d983e

Please sign in to comment.