/
is_future_range.hpp
68 lines (56 loc) · 2 KB
/
is_future_range.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (c) 2007-2012 Hartmut Kaiser
//
// 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(HPX_TRAITS_IS_FUTURE_RANGE_HPP)
#define HPX_TRAITS_IS_FUTURE_RANGE_HPP
#include <hpx/traits/is_future.hpp>
#include <hpx/traits/is_range.hpp>
#include <hpx/util/decay.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/or.hpp>
#include <boost/range/iterator_range.hpp>
#include <vector>
namespace hpx { namespace traits
{
///////////////////////////////////////////////////////////////////////////
template <typename Range, typename>
struct is_future_range
: boost::mpl::false_
{};
template <typename Range>
struct is_future_range<Range,
typename boost::enable_if<is_range<Range> >::type>
: is_future<typename util::decay<Range>::type::value_type>
{};
template <typename Iterator>
struct is_future_range<boost::iterator_range<Iterator> >
: is_future<typename std::iterator_traits<Iterator>::value_type>
{};
///////////////////////////////////////////////////////////////////////////
template <typename Range, typename Enable>
struct future_range_traits;
template <typename Range>
struct future_range_traits<
Range, typename boost::enable_if<is_future_range<Range> >::type
>
{
typedef typename Range::value_type future_type;
};
template <typename Iterator>
struct future_range_traits<
boost::iterator_range<Iterator>,
typename boost::enable_if<
is_future<typename std::iterator_traits<Iterator>::value_type>
>::type
>
{
typedef typename std::iterator_traits<Iterator>::value_type future_type;
};
///////////////////////////////////////////////////////////////////////////
template <typename T>
struct is_future_or_future_range
: boost::mpl::or_<is_future<T>, is_future_range<T> >
{};
}}
#endif