forked from boostorg/fusion
ODR safe code
[SVN r35275]
This commit is contained in:
@ -13,7 +13,11 @@
|
||||
#include <boost/fusion/support/tags.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
{
|
||||
struct array_tag; // boost::array tag
|
||||
struct mpl_sequence_tag; // mpl sequence tag
|
||||
struct std_pair_tag; // std::pair tag
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
@ -24,6 +28,15 @@ namespace boost { namespace fusion
|
||||
: detail::fusion_category_of<T>
|
||||
{};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct category_of_impl<array_tag>;
|
||||
|
||||
template <>
|
||||
struct category_of_impl<mpl_sequence_tag>;
|
||||
|
||||
template <>
|
||||
struct category_of_impl<std_pair_tag>;
|
||||
}
|
||||
|
||||
namespace traits
|
||||
|
@ -12,25 +12,26 @@
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/support/tag_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_associative_impl
|
||||
{
|
||||
template<typename Seq>
|
||||
struct apply
|
||||
: mpl::false_
|
||||
{};
|
||||
};
|
||||
template<typename Tag>
|
||||
struct is_associative_impl
|
||||
{
|
||||
template<typename Seq>
|
||||
struct apply : mpl::false_ {};
|
||||
};
|
||||
}
|
||||
|
||||
namespace traits
|
||||
{
|
||||
template <typename Seq>
|
||||
struct is_associative
|
||||
: extension::is_associative_impl<typename detail::tag_of<Seq>::type>::template apply<Seq>
|
||||
{};
|
||||
}}}
|
||||
template <typename Seq>
|
||||
struct is_associative
|
||||
: extension::is_associative_impl<typename detail::tag_of<Seq>::type>::
|
||||
template apply<Seq>
|
||||
{};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
@ -18,10 +18,13 @@
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct non_fusion_tag;
|
||||
struct array_tag; // boost::array tag
|
||||
struct mpl_sequence_tag; // mpl sequence tag
|
||||
struct std_pair_tag; // std::pair tag
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
struct is_sequence_impl
|
||||
: is_base_and_derived<sequence_root, T>
|
||||
{
|
||||
@ -31,19 +34,29 @@ namespace boost { namespace fusion
|
||||
{};
|
||||
};
|
||||
|
||||
template<>
|
||||
template <>
|
||||
struct is_sequence_impl<non_fusion_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply : mpl::false_ {};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_sequence_impl<array_tag>;
|
||||
|
||||
template <>
|
||||
struct is_sequence_impl<mpl_sequence_tag>;
|
||||
|
||||
template <>
|
||||
struct is_sequence_impl<std_pair_tag>;
|
||||
}
|
||||
|
||||
namespace traits
|
||||
{
|
||||
template <typename T>
|
||||
struct is_sequence
|
||||
: extension::is_sequence_impl<typename detail::tag_of<T>::type>::template apply<T>
|
||||
: extension::is_sequence_impl<typename detail::tag_of<T>::type>::
|
||||
template apply<T>
|
||||
{};
|
||||
}
|
||||
}}
|
||||
|
@ -13,6 +13,10 @@
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct array_tag; // boost::array tag
|
||||
struct mpl_sequence_tag; // mpl sequence tag
|
||||
struct std_pair_tag; // std::pair tag
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
@ -23,6 +27,15 @@ namespace boost { namespace fusion
|
||||
: detail::fusion_is_view<T>
|
||||
{};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_view_impl<array_tag>;
|
||||
|
||||
template <>
|
||||
struct is_view_impl<mpl_sequence_tag>;
|
||||
|
||||
template <>
|
||||
struct is_view_impl<std_pair_tag>;
|
||||
}
|
||||
|
||||
namespace traits
|
||||
@ -32,6 +45,7 @@ namespace boost { namespace fusion
|
||||
extension::is_view_impl<typename detail::tag_of<T>::type>::
|
||||
template apply<T>::type
|
||||
{};
|
||||
}}}
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
@ -10,8 +10,16 @@
|
||||
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
#include <boost/fusion/support/detail/is_mpl_sequence.hpp>
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <typename T, std::size_t N>
|
||||
class array; // forward
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -30,11 +38,20 @@ namespace boost { namespace fusion
|
||||
typedef non_fusion_tag type;
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
template <typename Sequence>
|
||||
struct tag_of<Sequence, typename boost::enable_if<detail::has_fusion_tag<Sequence> >::type>
|
||||
{
|
||||
typedef typename Sequence::fusion_tag type;
|
||||
};
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct tag_of<boost::array<T, N> >;
|
||||
|
||||
template <typename Sequence>
|
||||
struct tag_of<Sequence, typename boost::enable_if<detail::is_mpl_sequence<Sequence> >::type>;
|
||||
|
||||
template<typename T1, typename T2>
|
||||
struct tag_of<std::pair<T1, T2> >;
|
||||
}
|
||||
|
||||
namespace detail
|
||||
|
Reference in New Issue
Block a user