More constexpr and noexcept support.

Note 1: Forwarding functions are specified as a C++14 constexpr since
std::forward is not a constexpr within C++11.

Note 2: Though I'm not sure why it doesn't compile, some declarations
are specified as a C++14 constexpr or non-constexpr.

Note 3: Boost.Tuple adaptation and TR1-based tuple implementations are
not constexpr.
This commit is contained in:
Kohei Takahashi
2015-03-03 02:21:02 +09:00
parent d7c918e36f
commit 2114bfca6c
280 changed files with 1107 additions and 935 deletions

View File

@ -21,7 +21,7 @@
namespace boost { namespace fusion { namespace detail
{
template <typename First, typename Last, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline bool
linear_all(First const&, Last const&, F const&, mpl::true_)
{
@ -29,12 +29,12 @@ namespace boost { namespace fusion { namespace detail
}
template <typename First, typename Last, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline bool
linear_all(First const& first, Last const& last, F& f, mpl::false_)
{
typename result_of::deref<First>::type x = *first;
return f(x) &&
return f(x) &&
detail::linear_all(
fusion::next(first)
, last
@ -43,7 +43,7 @@ namespace boost { namespace fusion { namespace detail
}
template <typename Sequence, typename F, typename Tag>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline bool
all(Sequence const& seq, F f, Tag)
{
@ -60,11 +60,11 @@ namespace boost { namespace fusion { namespace detail
struct unrolled_all
{
template <typename It, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool call(It const& it, F f)
{
return
f(*it) &&
return
f(*it) &&
f(*fusion::advance_c<1>(it))&&
f(*fusion::advance_c<2>(it)) &&
f(*fusion::advance_c<3>(it)) &&
@ -76,11 +76,11 @@ namespace boost { namespace fusion { namespace detail
struct unrolled_all<3>
{
template <typename It, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool call(It const& it, F f)
{
return
f(*it) &&
return
f(*it) &&
f(*fusion::advance_c<1>(it)) &&
f(*fusion::advance_c<2>(it));
}
@ -90,11 +90,11 @@ namespace boost { namespace fusion { namespace detail
struct unrolled_all<2>
{
template <typename It, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool call(It const& it, F f)
{
return
f(*it) &&
return
f(*it) &&
f(*fusion::advance_c<1>(it));
}
};
@ -103,7 +103,7 @@ namespace boost { namespace fusion { namespace detail
struct unrolled_all<1>
{
template <typename It, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool call(It const& it, F f)
{
return f(*it);
@ -114,7 +114,7 @@ namespace boost { namespace fusion { namespace detail
struct unrolled_all<0>
{
template <typename It, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool call(It const& /*it*/, F /*f*/)
{
return true;
@ -122,7 +122,7 @@ namespace boost { namespace fusion { namespace detail
};
template <typename Sequence, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline bool
all(Sequence const& seq, F f, random_access_traversal_tag)
{

View File

@ -24,7 +24,7 @@ namespace boost { namespace fusion {
namespace detail
{
template <typename First, typename Last, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline bool
linear_any(First const&, Last const&, F const&, mpl::true_)
{
@ -32,12 +32,12 @@ namespace detail
}
template <typename First, typename Last, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline bool
linear_any(First const& first, Last const& last, F& f, mpl::false_)
{
typename result_of::deref<First>::type x = *first;
return f(x) ||
return f(x) ||
detail::linear_any(
fusion::next(first)
, last
@ -46,7 +46,7 @@ namespace detail
}
template <typename Sequence, typename F, typename Tag>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline bool
any(Sequence const& seq, F f, Tag)
{
@ -63,11 +63,11 @@ namespace detail
struct unrolled_any
{
template <typename It, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool call(It const& it, F f)
{
return
f(*it) ||
return
f(*it) ||
f(*fusion::advance_c<1>(it))||
f(*fusion::advance_c<2>(it)) ||
f(*fusion::advance_c<3>(it)) ||
@ -79,11 +79,11 @@ namespace detail
struct unrolled_any<3>
{
template <typename It, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool call(It const& it, F f)
{
return
f(*it) ||
return
f(*it) ||
f(*fusion::advance_c<1>(it)) ||
f(*fusion::advance_c<2>(it));
}
@ -93,11 +93,11 @@ namespace detail
struct unrolled_any<2>
{
template <typename It, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool call(It const& it, F f)
{
return
f(*it) ||
return
f(*it) ||
f(*fusion::advance_c<1>(it));
}
};
@ -106,7 +106,7 @@ namespace detail
struct unrolled_any<1>
{
template <typename It, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool call(It const& it, F f)
{
return f(*it);
@ -117,7 +117,7 @@ namespace detail
struct unrolled_any<0>
{
template <typename It, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool call(It const&, F)
{
return false;
@ -125,7 +125,7 @@ namespace detail
};
template <typename Sequence, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline bool
any(Sequence const& seq, F f, random_access_traversal_tag)
{

View File

@ -25,10 +25,10 @@ namespace boost { namespace fusion { namespace detail
// T1 is convertible to T2 or vice versa
template <>
struct compare_convertible<true>
struct compare_convertible<true>
{
template <typename T1, typename T2>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool
call(T1 const& x, T2 const& y)
{
@ -41,7 +41,7 @@ namespace boost { namespace fusion { namespace detail
struct compare_convertible<false>
{
template <typename T1, typename T2>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static bool
call(T1 const&, T2 const&)
{
@ -53,16 +53,16 @@ namespace boost { namespace fusion { namespace detail
struct count_compare
{
typedef typename detail::call_param<T1>::type param;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
count_compare(param in_x)
: x(in_x) {}
template <typename T2>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
bool
operator()(T2 const& y)
operator()(T2 const& y) const
{
return
return
compare_convertible<
mpl::or_<
is_convertible<T1, T2>

View File

@ -24,7 +24,7 @@ namespace boost { namespace fusion {
namespace detail
{
template <typename First, typename Last, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline int
linear_count_if(First const&, Last const&, F const&, mpl::true_)
{
@ -32,11 +32,11 @@ namespace detail
}
template <typename First, typename Last, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline int
linear_count_if(First const& first, Last const& last, F& f, mpl::false_)
{
int n =
int n =
detail::linear_count_if(
fusion::next(first)
, last
@ -48,7 +48,7 @@ namespace detail
}
template <typename Sequence, typename F, typename Tag>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline int
count_if(Sequence const& seq, F f, Tag)
{
@ -65,7 +65,7 @@ namespace detail
struct unrolled_count_if
{
template<typename I0, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static int call(I0 const& i0, F f)
{
int ct = unrolled_count_if<n-4>::
@ -96,7 +96,7 @@ namespace detail
struct unrolled_count_if<3>
{
template<typename I0, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static int call(I0 const& i0, F f)
{
int ct = 0;
@ -121,7 +121,7 @@ namespace detail
struct unrolled_count_if<2>
{
template<typename I0, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static int call(I0 const& i0, F f)
{
int ct = 0;
@ -142,7 +142,7 @@ namespace detail
struct unrolled_count_if<1>
{
template<typename I0, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static int call(I0 const& i0, F f)
{
int ct = 0;
@ -157,7 +157,7 @@ namespace detail
struct unrolled_count_if<0>
{
template<typename I0, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static int call(I0 const&, F)
{
return 0;
@ -165,7 +165,7 @@ namespace detail
};
template <typename Sequence, typename F>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline int
count_if(Sequence const& seq, F f, random_access_traversal_tag)
{

View File

@ -184,7 +184,7 @@ namespace detail
type;
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
recursive_call(Iterator const& iter, mpl::true_)
{
@ -192,7 +192,7 @@ namespace detail
}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
recursive_call(Iterator const& iter, mpl::false_)
{
@ -200,7 +200,7 @@ namespace detail
}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
recursive_call(Iterator const& iter)
{
@ -209,7 +209,7 @@ namespace detail
}
template <typename Iterator, typename Tag>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
choose_call(Iterator const& iter, Tag)
{
@ -217,7 +217,7 @@ namespace detail
}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
choose_call(Iterator const& iter, random_access_traversal_tag)
{
@ -226,7 +226,7 @@ namespace detail
}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
iter_call(Iterator const& iter)
{
@ -234,7 +234,7 @@ namespace detail
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& seq)
{

View File

@ -45,19 +45,19 @@ namespace boost { namespace fusion { namespace detail
>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq, State const&state, Context const& context, segmented_find_fun)
{
return call_impl(seq, state, context, continue_type());
}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call_impl(Sequence&, State const&state, Context const&, mpl::true_)
{
return state;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call_impl(Sequence& seq, State const&, Context const& context, mpl::false_)
{
return fusion::make_segmented_iterator(fusion::find<T>(seq), context);
@ -78,7 +78,7 @@ namespace boost { namespace fusion { namespace detail
>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq)
{
return fusion::segmented_fold_until(

View File

@ -45,19 +45,19 @@ namespace boost { namespace fusion { namespace detail
>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq, State const&state, Context const& context, segmented_find_if_fun)
{
return call_impl(seq, state, context, continue_type());
}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call_impl(Sequence&, State const&state, Context const&, mpl::true_)
{
return state;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call_impl(Sequence& seq, State const&, Context const& context, mpl::false_)
{
return fusion::make_segmented_iterator(fusion::find_if<Pred>(seq), context);
@ -78,7 +78,7 @@ namespace boost { namespace fusion { namespace detail
>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq)
{
return fusion::segmented_fold_until(