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

@ -17,7 +17,7 @@ namespace boost { namespace fusion { namespace detail
{
typedef typename result_of::value_of<It>::type type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static inline type call(It const& it)
{
return *it;
@ -31,7 +31,7 @@ namespace boost { namespace fusion { namespace detail
typedef typename result_of::value_of_data<It>::type data_type;
typedef typename fusion::pair<key_type, data_type> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static inline type call(It const& it)
{
return type(deref_data(it));
@ -69,7 +69,7 @@ namespace boost { namespace fusion
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::as_map<Sequence>::type
as_map(Sequence& seq)
{
@ -78,7 +78,7 @@ namespace boost { namespace fusion
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::as_map<Sequence const>::type
as_map(Sequence const& seq)
{
@ -101,7 +101,7 @@ namespace boost { namespace fusion
result_of::as_map<Sequence>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq)
{
typedef result_of::as_map<Sequence> gen;

View File

@ -31,7 +31,7 @@ namespace boost { namespace fusion
decltype(boost::declval<Sequence>().get(index()))
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& m)
{
@ -47,7 +47,7 @@ namespace boost { namespace fusion
decltype(boost::declval<Sequence const>().get(index()))
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence const& m)
{

View File

@ -33,7 +33,7 @@ namespace boost { namespace fusion
decltype(boost::declval<Sequence>().get(mpl::identity<Key>()))
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& m)
{
@ -48,7 +48,7 @@ namespace boost { namespace fusion
decltype(boost::declval<Sequence const>().get(mpl::identity<Key>()))
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence const& m)
{

View File

@ -27,7 +27,7 @@ namespace boost { namespace fusion
{
typedef map_iterator<Sequence, 0> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq)
{
return type(seq);

View File

@ -28,7 +28,7 @@ namespace boost { namespace fusion { namespace detail
struct build_map<First, Last, is_assoc, true>
{
typedef map<> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(First const&, Last const&)
{
@ -44,7 +44,7 @@ namespace boost { namespace fusion { namespace detail
{
typedef map<T, Rest...> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(T const& first, map<Rest...> const& rest)
{
@ -66,7 +66,7 @@ namespace boost { namespace fusion { namespace detail
typedef typename push_front::type type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(First const& f, Last const& l)
{

View File

@ -37,7 +37,7 @@ BOOST_FUSION_BARRIER_BEGIN
};
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static typename apply<Iterator>::type
call(Iterator)
{
@ -127,7 +127,7 @@ BOOST_FUSION_BARRIER_END
};
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static typename apply<Iterator>::type
call(Iterator const& i0)
{

View File

@ -27,14 +27,14 @@ namespace boost { namespace fusion
struct at_impl<map_tag>
{
template <typename Sequence, typename N>
struct apply
struct apply
{
typedef typename
mpl::at<typename Sequence::storage_type::types, N>::type
typedef typename
mpl::at<typename Sequence::storage_type::types, N>::type
element;
typedef typename detail::ref_result<element>::type type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& m)
{
@ -45,12 +45,12 @@ namespace boost { namespace fusion
template <typename Sequence, typename N>
struct apply<Sequence const, N>
{
typedef typename
mpl::at<typename Sequence::storage_type::types, N>::type
typedef typename
mpl::at<typename Sequence::storage_type::types, N>::type
element;
typedef typename detail::cref_result<element>::type type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence const& m)
{

View File

@ -32,7 +32,7 @@ namespace boost { namespace fusion { namespace extension
>
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Seq& seq)
{

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::as_map<Sequence>::type
as_map(Sequence& seq)
{
@ -45,7 +45,7 @@ namespace boost { namespace fusion
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::as_map<Sequence const>::type
as_map(Sequence const& seq)
{

View File

@ -41,7 +41,7 @@ namespace boost { namespace fusion
template apply<typename result_of::begin<Sequence>::type>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq)
{
return gen::call(fusion::begin(seq));

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion { namespace extension
>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(It const& it)
{

View File

@ -34,7 +34,7 @@ namespace boost { namespace fusion { namespace extension
>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(It const& it)
{

View File

@ -32,7 +32,7 @@ namespace boost { namespace fusion { namespace extension
>
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Seq& seq)
{

View File

@ -65,35 +65,35 @@ namespace boost { namespace fusion
typedef typename storage_type::size size;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map()
: data() {}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map(Sequence const& rhs)
: data(rhs) {}
#include <boost/fusion/container/map/detail/cpp03/map_forward_ctor.hpp>
template <typename T>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map& operator=(T const& rhs)
{
data = rhs;
return *this;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map& operator=(map const& rhs)
{
data = rhs.data;
return *this;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
storage_type& get_data() { return data; }
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
storage_type const& get_data() const { return data; }
private:

View File

@ -27,7 +27,7 @@
#define N BOOST_PP_ITERATION()
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
#if N == 1
explicit
#endif

View File

@ -24,7 +24,7 @@ namespace boost { namespace fusion
struct value_at_impl<map_tag>
{
template <typename Sequence, typename N>
struct apply
struct apply
{
typedef typename mpl::at<typename Sequence::storage_type::types, N>::type type;
};

View File

@ -27,7 +27,7 @@ namespace boost { namespace fusion
{
typedef map_iterator<Sequence, Sequence::size::value> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq)
{
return type(seq);

View File

@ -33,24 +33,24 @@ namespace boost { namespace fusion { namespace detail
static int const index = index_;
static int const size = 0;
BOOST_FUSION_GPU_ENABLED
map_impl() {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl() BOOST_NOEXCEPT {}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
map_impl(Iterator const&, map_impl_from_iterator)
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl(Iterator const&, map_impl_from_iterator) BOOST_NOEXCEPT
{}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
void assign(Iterator const&, map_impl_from_iterator)
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void assign(Iterator const&, map_impl_from_iterator) BOOST_NOEXCEPT
{}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void get();
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void get_val();
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void get_key();
};
@ -71,54 +71,54 @@ namespace boost { namespace fusion { namespace detail
typedef typename Pair::first_type key_type;
typedef typename Pair::second_type value_type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl()
: rest_type(), element()
{}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl(map_impl const& rhs)
: rest_type(rhs.get_base()), element(rhs.element)
{}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl(map_impl&& rhs)
: rest_type(BOOST_FUSION_FWD_ELEM(rest_type, *static_cast<rest_type*>(&rhs)))
, element(BOOST_FUSION_FWD_ELEM(Pair, rhs.element))
{}
template <typename ...U>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl(map_impl<index, U...> const& rhs)
: rest_type(rhs.get_base()), element(rhs.element)
{}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl(typename detail::call_param<Pair>::type element_
, typename detail::call_param<T>::type... rest)
: rest_type(rest...), element(element_)
{}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl(Pair&& element_, T&&... rest)
: rest_type(BOOST_FUSION_FWD_ELEM(T, rest)...)
, element(BOOST_FUSION_FWD_ELEM(Pair, element_))
{}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl(Iterator const& iter, map_impl_from_iterator fi)
: rest_type(fusion::next(iter), fi)
, element(*iter)
{}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
rest_type& get_base()
{
return *this;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
rest_type const& get_base() const
{
return *this;
@ -138,28 +138,28 @@ namespace boost { namespace fusion { namespace detail
BOOST_FUSION_GPU_ENABLED
mpl::identity<key_type> get_key(mpl::int_<index>) const;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename cref_result<value_type>::type
get(mpl::identity<key_type>) const
{
return element.second;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename ref_result<value_type>::type
get(mpl::identity<key_type>)
{
return element.second;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename cref_result<pair_type>::type
get(mpl::int_<index>) const
{
return element;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename ref_result<pair_type>::type
get(mpl::int_<index>)
{
@ -167,7 +167,7 @@ namespace boost { namespace fusion { namespace detail
}
template <typename ...U>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl& operator=(map_impl<index, U...> const& rhs)
{
rest_type::operator=(rhs);
@ -175,7 +175,7 @@ namespace boost { namespace fusion { namespace detail
return *this;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl& operator=(map_impl const& rhs)
{
rest_type::operator=(rhs);
@ -183,7 +183,7 @@ namespace boost { namespace fusion { namespace detail
return *this;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_impl& operator=(map_impl&& rhs)
{
rest_type::operator=(std::forward<map_impl>(rhs));
@ -192,7 +192,7 @@ namespace boost { namespace fusion { namespace detail
}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void assign(Iterator const& iter, map_impl_from_iterator fi)
{
rest_type::assign(fusion::next(iter), fi);

View File

@ -52,60 +52,60 @@ namespace boost { namespace fusion
typedef mpl::int_<base_type::size> size;
typedef mpl::false_ is_view;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map() {}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map(map const& seq)
: base_type(seq.base())
{}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map(map&& seq)
: base_type(std::forward<map>(seq))
{}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map(Sequence const& seq
, typename enable_if<traits::is_sequence<Sequence>>::type* /*dummy*/ = 0)
: base_type(begin(seq), detail::map_impl_from_iterator())
{}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map(Sequence& seq
, typename enable_if<traits::is_sequence<Sequence>>::type* /*dummy*/ = 0)
: base_type(begin(seq), detail::map_impl_from_iterator())
{}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map(Sequence&& seq
, typename enable_if<traits::is_sequence<Sequence>>::type* /*dummy*/ = 0)
: base_type(begin(seq), detail::map_impl_from_iterator())
{}
template <typename First, typename ...T_>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map(First const& first, T_ const&... rest)
: base_type(first, rest...)
{}
template <typename First, typename ...T_>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map(First&& first, T_&&... rest)
: base_type(BOOST_FUSION_FWD_ELEM(First, first), BOOST_FUSION_FWD_ELEM(T_, rest)...)
{}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map& operator=(map const& rhs)
{
base_type::operator=(rhs.base());
return *this;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map& operator=(map&& rhs)
{
base_type::operator=(std::forward<base_type>(rhs.base()));
@ -113,7 +113,7 @@ namespace boost { namespace fusion
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename enable_if<traits::is_sequence<Sequence>, map&>::type
operator=(Sequence const& seq)
{
@ -121,10 +121,10 @@ namespace boost { namespace fusion
return *this;
}
BOOST_FUSION_GPU_ENABLED
base_type& base() { return *this; }
BOOST_FUSION_GPU_ENABLED
base_type const& base() const { return *this; }
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
base_type& base() BOOST_NOEXCEPT { return *this; }
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
base_type const& base() const BOOST_NOEXCEPT { return *this; }
};
}}

View File

@ -30,7 +30,7 @@ namespace boost { namespace fusion
typedef Seq sequence;
typedef mpl::int_<Pos> index;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
map_iterator(Seq& seq)
: seq_(seq)
{}
@ -73,7 +73,7 @@ namespace boost { namespace fusion
decltype(boost::declval<sequence>().get(index()))
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& it)
{
@ -99,7 +99,7 @@ namespace boost { namespace fusion
typedef typename add_reference<second_type>::type type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& it)
{
@ -114,7 +114,7 @@ namespace boost { namespace fusion
typedef typename Iterator::sequence sequence;
typedef map_iterator<sequence, index::value + N::value> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& i)
{
@ -141,7 +141,7 @@ namespace boost { namespace fusion
>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(I1 const&, I2 const&)
{