os/ossrv/ossrv_pub/boost_apis/boost/utility/result_of.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Boost result_of library
sl@0
     2
sl@0
     3
//  Copyright Douglas Gregor 2004. Use, modification and
sl@0
     4
//  distribution is subject to the Boost Software License, Version
sl@0
     5
//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
sl@0
     6
//  http://www.boost.org/LICENSE_1_0.txt)
sl@0
     7
sl@0
     8
// For more information, see http://www.boost.org/libs/utility
sl@0
     9
#ifndef BOOST_RESULT_OF_HPP
sl@0
    10
#define BOOST_RESULT_OF_HPP
sl@0
    11
sl@0
    12
#include <boost/config.hpp>
sl@0
    13
#include <boost/type_traits/ice.hpp>
sl@0
    14
#include <boost/type.hpp>
sl@0
    15
#include <boost/preprocessor.hpp>
sl@0
    16
#include <boost/detail/workaround.hpp>
sl@0
    17
#include <boost/mpl/has_xxx.hpp>
sl@0
    18
sl@0
    19
#ifndef BOOST_RESULT_OF_NUM_ARGS
sl@0
    20
#  define BOOST_RESULT_OF_NUM_ARGS 10
sl@0
    21
#endif
sl@0
    22
sl@0
    23
namespace boost {
sl@0
    24
sl@0
    25
template<typename F> struct result_of;
sl@0
    26
sl@0
    27
#if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
sl@0
    28
namespace detail {
sl@0
    29
sl@0
    30
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
sl@0
    31
sl@0
    32
template<typename F, typename FArgs, bool HasResultType> struct get_result_of;
sl@0
    33
sl@0
    34
template<typename F, typename FArgs>
sl@0
    35
struct get_result_of<F, FArgs, true>
sl@0
    36
{
sl@0
    37
  typedef typename F::result_type type;
sl@0
    38
};
sl@0
    39
sl@0
    40
template<typename F, typename FArgs>
sl@0
    41
struct get_result_of<F, FArgs, false>
sl@0
    42
{
sl@0
    43
  typedef typename F::template result<FArgs>::type type;
sl@0
    44
};
sl@0
    45
sl@0
    46
template<typename F>
sl@0
    47
struct get_result_of<F, F(void), false>
sl@0
    48
{
sl@0
    49
  typedef void type;
sl@0
    50
};
sl@0
    51
sl@0
    52
template<typename F, typename FArgs>
sl@0
    53
struct result_of : get_result_of<F, FArgs, (has_result_type<F>::value)> {};
sl@0
    54
sl@0
    55
} // end namespace detail
sl@0
    56
sl@0
    57
#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_RESULT_OF_NUM_ARGS,<boost/utility/detail/result_of_iterate.hpp>))
sl@0
    58
#include BOOST_PP_ITERATE()
sl@0
    59
sl@0
    60
#else
sl@0
    61
#  define BOOST_NO_RESULT_OF 1
sl@0
    62
#endif
sl@0
    63
sl@0
    64
}
sl@0
    65
sl@0
    66
#endif // BOOST_RESULT_OF_HPP