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

@ -25,7 +25,7 @@ namespace boost { namespace fusion
// $$$ do we really want a cons_tie? $$$
template <typename Car>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline cons<Car&>
cons_tie(Car& car)
{
@ -34,7 +34,7 @@ namespace boost { namespace fusion
// $$$ do we really want a cons_tie? $$$
template <typename Car, typename Cdr>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline cons<Car&, Cdr>
cons_tie(Car& car, Cdr const& cdr)
{

View File

@ -34,7 +34,7 @@ namespace boost { namespace fusion
}
template <typename ...T>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline deque<T&...>
deque_tie(T&... arg)
{

View File

@ -89,7 +89,7 @@ namespace boost { namespace fusion
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline deque<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)>
deque_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & arg))
{

View File

@ -57,7 +57,8 @@ namespace boost { namespace fusion
};
}
BOOST_FUSION_GPU_ENABLED inline deque<>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline deque<>
make_deque()
{
return deque<>();
@ -102,7 +103,7 @@ namespace boost { namespace fusion
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline deque<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
make_deque(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& arg))
{

View File

@ -59,7 +59,8 @@ namespace boost { namespace fusion
};
}
BOOST_FUSION_GPU_ENABLED inline map<>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline map<>
make_map()
{
return map<>();
@ -116,7 +117,7 @@ namespace boost { namespace fusion
BOOST_PP_ENUM_PARAMS(N, typename K)
, BOOST_PP_ENUM_PARAMS(N, typename D)
>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline map<BOOST_PP_ENUM(N, BOOST_FUSION_PAIR, _)>
make_map(BOOST_PP_ENUM_BINARY_PARAMS(N, D, const& arg))
{

View File

@ -62,7 +62,8 @@ namespace boost { namespace fusion
};
}
BOOST_FUSION_GPU_ENABLED inline map<>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline map<>
map_tie()
{
return map<>();
@ -119,7 +120,7 @@ namespace boost { namespace fusion
BOOST_PP_ENUM_PARAMS(N, typename K)
, BOOST_PP_ENUM_PARAMS(N, typename D)
>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline map<BOOST_PP_ENUM(N, BOOST_FUSION_TIED_PAIR, _)>
map_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, D, & arg))
{

View File

@ -17,7 +17,7 @@ namespace boost { namespace fusion
struct swallow_assign
{
template<typename T>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
swallow_assign const&
operator=(const T&) const
{
@ -27,7 +27,7 @@ namespace boost { namespace fusion
}
// "ignore" allows tuple positions to be ignored when using "tie".
detail::swallow_assign const ignore = detail::swallow_assign();
BOOST_CONSTEXPR detail::swallow_assign const ignore = detail::swallow_assign();
}}
#endif

View File

@ -89,7 +89,7 @@ namespace boost { namespace fusion
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline list<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)>
list_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & arg))
{

View File

@ -26,7 +26,7 @@ namespace boost { namespace fusion
}
template <typename Car>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline cons<typename detail::as_fusion_element<Car>::type>
make_cons(Car const& car)
{
@ -34,7 +34,7 @@ namespace boost { namespace fusion
}
template <typename Car, typename Cdr>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline cons<typename detail::as_fusion_element<Car>::type, Cdr>
make_cons(Car const& car, Cdr const& cdr)
{

View File

@ -32,7 +32,7 @@ namespace boost { namespace fusion
}
template <typename ...T>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline deque<typename detail::as_fusion_element<T>::type...>
make_deque(T const&... arg)
{

View File

@ -56,7 +56,8 @@ namespace boost { namespace fusion
};
}
BOOST_FUSION_GPU_ENABLED inline list<>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline list<>
make_list()
{
return list<>();
@ -101,7 +102,7 @@ namespace boost { namespace fusion
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline list<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
make_list(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& arg))
{

View File

@ -41,7 +41,7 @@ namespace boost { namespace fusion
}
template <typename ...Key, typename ...T>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline map<
fusion::pair<
Key

View File

@ -13,6 +13,7 @@
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/set/set.hpp>
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#include <boost/fusion/support/pair.hpp>
@ -35,6 +36,7 @@
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 1)
#define FUSION_HASH #
#endif
namespace boost { namespace fusion
@ -57,7 +59,22 @@ namespace boost { namespace fusion
};
}
BOOST_FUSION_GPU_ENABLED inline set<>
// XXX:
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH else
BOOST_CONSTEXPR
FUSION_HASH endif
#else
#if defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#else
BOOST_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
inline set<>
make_set()
{
return set<>();
@ -76,6 +93,7 @@ namespace boost { namespace fusion
}}
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#undef FUSION_HASH
#pragma wave option(output: null)
#endif
@ -103,7 +121,7 @@ namespace boost { namespace fusion
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline set<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
make_set(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& arg))
{

View File

@ -56,7 +56,8 @@ namespace boost { namespace fusion
};
}
BOOST_FUSION_GPU_ENABLED inline vector0<>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline vector0<>
make_vector()
{
return vector0<>();
@ -101,7 +102,7 @@ namespace boost { namespace fusion
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
make_vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& arg))
{

View File

@ -35,7 +35,7 @@ namespace boost { namespace fusion
}
template <typename ...Key, typename ...T>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline map<fusion::pair<Key, T&>...>
map_tie(T&... arg)
{

View File

@ -27,7 +27,7 @@ namespace boost { namespace fusion {
}
template<typename Key, typename T>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename disable_if<is_const<T>, typename result_of::pair_tie<Key, T>::type>::type
pair_tie(T& t)
{
@ -35,7 +35,7 @@ namespace boost { namespace fusion {
}
template<typename Key, typename T>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename result_of::pair_tie<Key, T const>::type
pair_tie(T const& t)
{

View File

@ -87,7 +87,7 @@ namespace boost { namespace fusion
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline vector<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)>
vector_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & arg))
{