mirror of
https://github.com/boostorg/range.git
synced 2025-07-30 04:47:25 +02:00
add std::tuple_element and std::tuple_size specializations for index_value
To make index_value work with structured bindings https://wandbox.org/permlink/gsveiKdAamnEbOKM
This commit is contained in:
@ -367,4 +367,29 @@ index(
|
|||||||
} // namespace adaptors
|
} // namespace adaptors
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
|
||||||
|
#if defined(BOOST_CLANG)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wmismatched-tags"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<size_t N, class T, class Indexable>
|
||||||
|
struct tuple_element<N, boost::range::index_value<T, Indexable>>:
|
||||||
|
boost::tuples::element<N, boost::range::index_value<T, Indexable>> {};
|
||||||
|
|
||||||
|
template<class T, class Indexable>
|
||||||
|
struct tuple_size<boost::range::index_value<T, Indexable>>:
|
||||||
|
std::integral_constant<std::size_t, 2> {};
|
||||||
|
|
||||||
|
#if defined(BOOST_CLANG)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE)
|
||||||
|
|
||||||
#endif // include guard
|
#endif // include guard
|
||||||
|
Reference in New Issue
Block a user