mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-31 13:07:28 +02:00
adds result metafunction for make_pair and pair members
[SVN r35748]
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
/*=============================================================================
|
/*=============================================================================
|
||||||
Copyright (c) 2005 Joel de Guzman
|
Copyright (c) 2005 Joel de Guzman
|
||||||
|
Copyright (c) 2006 Tobias Schwinger
|
||||||
|
|
||||||
Use, modification and distribution is subject to the Boost Software
|
Use, modification and distribution is subject to the Boost Software
|
||||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -40,8 +41,30 @@ namespace boost { namespace fusion
|
|||||||
Second second;
|
Second second;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template<typename First, typename Second>
|
||||||
|
struct make_pair
|
||||||
|
{
|
||||||
|
typedef fusion::pair<First,
|
||||||
|
typename detail::as_fusion_element<Second>::type> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Pair>
|
||||||
|
struct first
|
||||||
|
{
|
||||||
|
typedef typename Pair::first_type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Pair>
|
||||||
|
struct second
|
||||||
|
{
|
||||||
|
typedef typename Pair::second_type type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
template <typename First, typename Second>
|
template <typename First, typename Second>
|
||||||
inline pair<First, typename detail::as_fusion_element<Second>::type>
|
inline typename result_of::make_pair<First,Second>::type
|
||||||
make_pair(Second const& val)
|
make_pair(Second const& val)
|
||||||
{
|
{
|
||||||
return pair<First, typename detail::as_fusion_element<Second>::type>(val);
|
return pair<First, typename detail::as_fusion_element<Second>::type>(val);
|
||||||
|
Reference in New Issue
Block a user