Make boost::tuple tuple-like to support structured bindings

This commit is contained in:
Peter Dimov committed 2018-01-03 19:26:11 +02:00
1 parent c51d8a9495
commit 16731d2689
6 files changed
+247 -10

No files matched your search

+11 -10
View File
@@ -37,6 +37,7 @@
#include <boost/type_traits/cv_traits.hpp>
#include <boost/type_traits/function_traits.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/utility/swap.hpp>
#include <boost/detail/workaround.hpp> // needed for BOOST_WORKAROUND
@@ -420,28 +421,28 @@ struct cons<HT, null_type> {
// templates for finding out the length of the tuple -------------------
template<class T>
struct length {
BOOST_STATIC_CONSTANT(int, value = 1 + length<typename T::tail_type>::value);
struct length: boost::integral_constant<int, 1 + length<typename T::tail_type>::value>
{
};
template<>
struct length<tuple<> > {
BOOST_STATIC_CONSTANT(int, value = 0);
struct length<tuple<> >: boost::integral_constant<int, 0>
{
};
template<>
struct length<tuple<> const> {
BOOST_STATIC_CONSTANT(int, value = 0);
struct length<tuple<> const>: boost::integral_constant<int, 0>
{
};
template<>
struct length<null_type> {
BOOST_STATIC_CONSTANT(int, value = 0);
struct length<null_type>: boost::integral_constant<int, 0>
{
};
template<>
struct length<null_type const> {
BOOST_STATIC_CONSTANT(int, value = 0);
struct length<null_type const>: boost::integral_constant<int, 0>
{
};
namespace detail {