forked from boostorg/fusion
adapt template classes/structs
[SVN r59846]
This commit is contained in:
@ -1,89 +1,24 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
Copyright (c) 2009-2010 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_STD_PAIR_24122005_1744)
|
||||
#define BOOST_FUSION_STD_PAIR_24122005_1744
|
||||
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
#include <boost/fusion/adapted/struct.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/config/no_tr1/utility.hpp>
|
||||
#ifndef BOOST_FUSION_ADAPTED_STD_PAIR_HPP
|
||||
#define BOOST_FUSION_ADAPTED_STD_PAIR_HPP
|
||||
|
||||
namespace boost { namespace fusion
|
||||
#include <boost/fusion/adapted/struct/adapt_struct.hpp>
|
||||
|
||||
namespace std
|
||||
{
|
||||
struct struct_tag;
|
||||
struct fusion_sequence_tag;
|
||||
template<class T1, class T2>
|
||||
struct pair;
|
||||
}
|
||||
|
||||
namespace traits
|
||||
{
|
||||
template <typename T1, typename T2>
|
||||
#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
|
||||
struct tag_of<std::pair<T1, T2>, void >
|
||||
#else
|
||||
struct tag_of<std::pair<T1, T2> >
|
||||
#endif
|
||||
{
|
||||
typedef struct_tag type;
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl
|
||||
{
|
||||
template<typename>
|
||||
struct sequence_tag;
|
||||
|
||||
template<typename T1, typename T2>
|
||||
struct sequence_tag<std::pair<T1, T2> >
|
||||
{
|
||||
typedef fusion::fusion_sequence_tag type;
|
||||
};
|
||||
|
||||
template<typename T1, typename T2>
|
||||
struct sequence_tag<std::pair<T1, T2> const>
|
||||
{
|
||||
typedef fusion::fusion_sequence_tag type;
|
||||
};
|
||||
}}
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename Struct, int N>
|
||||
struct struct_member;
|
||||
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct struct_member<std::pair<T1, T2>, 0>
|
||||
{
|
||||
typedef T1 type;
|
||||
|
||||
static type& call(std::pair<T1, T2>& pair)
|
||||
{
|
||||
return pair.first;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct struct_member<std::pair<T1, T2>, 1>
|
||||
{
|
||||
typedef T2 type;
|
||||
|
||||
static type& call(std::pair<T1, T2>& pair)
|
||||
{
|
||||
return pair.second;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct struct_size<std::pair<T1, T2> > : mpl::int_<2>
|
||||
{
|
||||
};
|
||||
}}}
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT(
|
||||
(T1)(T2),(std::pair)(T1)(T2),(T1, first)(T2, second))
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user