From cde9259b1a8d5c2b92c09f9221cc9dee67cc6854 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 2 Jun 2017 18:20:37 +0300 Subject: [PATCH] Rename mp_for_index to mp_with_index --- include/boost/mp11/algorithm.hpp | 2 +- .../{mp_for_index.hpp => mp_with_index.hpp} | 52 +++++++++---------- test/Jamfile.v2 | 4 +- test/{mp_for_index.cpp => mp_with_index.cpp} | 6 +-- ..._for_index_cx.cpp => mp_with_index_cx.cpp} | 4 +- 5 files changed, 34 insertions(+), 34 deletions(-) rename include/boost/mp11/detail/{mp_for_index.hpp => mp_with_index.hpp} (91%) rename test/{mp_for_index.cpp => mp_with_index.cpp} (92%) rename test/{mp_for_index_cx.cpp => mp_with_index_cx.cpp} (88%) diff --git a/include/boost/mp11/algorithm.hpp b/include/boost/mp11/algorithm.hpp index f9e409f..996a61f 100644 --- a/include/boost/mp11/algorithm.hpp +++ b/include/boost/mp11/algorithm.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/boost/mp11/detail/mp_for_index.hpp b/include/boost/mp11/detail/mp_with_index.hpp similarity index 91% rename from include/boost/mp11/detail/mp_for_index.hpp rename to include/boost/mp11/detail/mp_with_index.hpp index 8ae5aac..b198635 100644 --- a/include/boost/mp11/detail/mp_for_index.hpp +++ b/include/boost/mp11/detail/mp_with_index.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_MP11_DETAIL_MP_FOR_INDEX_HPP_INCLUDED -#define BOOST_MP11_DETAIL_MP_FOR_INDEX_HPP_INCLUDED +#ifndef BOOST_MP11_DETAIL_MP_WITH_INDEX_HPP_INCLUDED +#define BOOST_MP11_DETAIL_MP_WITH_INDEX_HPP_INCLUDED // Copyright 2017 Peter Dimov. // @@ -28,7 +28,7 @@ namespace mp11 namespace detail { -template struct mp_for_index_impl_ +template struct mp_with_index_impl_ { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -52,15 +52,15 @@ template struct mp_for_index_impl_ case 15: return std::forward(f)( mp_size_t() ); } - return mp_for_index_impl_::template call( i-16, std::forward(f) ); + return mp_with_index_impl_::template call( i-16, std::forward(f) ); } }; -template<> struct mp_for_index_impl_<0> +template<> struct mp_with_index_impl_<0> { }; -template<> struct mp_for_index_impl_<1> +template<> struct mp_with_index_impl_<1> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t /*i*/, F && f ) { @@ -68,7 +68,7 @@ template<> struct mp_for_index_impl_<1> } }; -template<> struct mp_for_index_impl_<2> +template<> struct mp_with_index_impl_<2> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -80,7 +80,7 @@ template<> struct mp_for_index_impl_<2> } }; -template<> struct mp_for_index_impl_<3> +template<> struct mp_with_index_impl_<3> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -93,7 +93,7 @@ template<> struct mp_for_index_impl_<3> } }; -template<> struct mp_for_index_impl_<4> +template<> struct mp_with_index_impl_<4> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -107,7 +107,7 @@ template<> struct mp_for_index_impl_<4> } }; -template<> struct mp_for_index_impl_<5> +template<> struct mp_with_index_impl_<5> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -122,7 +122,7 @@ template<> struct mp_for_index_impl_<5> } }; -template<> struct mp_for_index_impl_<6> +template<> struct mp_with_index_impl_<6> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -138,7 +138,7 @@ template<> struct mp_for_index_impl_<6> } }; -template<> struct mp_for_index_impl_<7> +template<> struct mp_with_index_impl_<7> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -155,7 +155,7 @@ template<> struct mp_for_index_impl_<7> } }; -template<> struct mp_for_index_impl_<8> +template<> struct mp_with_index_impl_<8> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -173,7 +173,7 @@ template<> struct mp_for_index_impl_<8> } }; -template<> struct mp_for_index_impl_<9> +template<> struct mp_with_index_impl_<9> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -192,7 +192,7 @@ template<> struct mp_for_index_impl_<9> } }; -template<> struct mp_for_index_impl_<10> +template<> struct mp_with_index_impl_<10> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -212,7 +212,7 @@ template<> struct mp_for_index_impl_<10> } }; -template<> struct mp_for_index_impl_<11> +template<> struct mp_with_index_impl_<11> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -233,7 +233,7 @@ template<> struct mp_for_index_impl_<11> } }; -template<> struct mp_for_index_impl_<12> +template<> struct mp_with_index_impl_<12> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -255,7 +255,7 @@ template<> struct mp_for_index_impl_<12> } }; -template<> struct mp_for_index_impl_<13> +template<> struct mp_with_index_impl_<13> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -278,7 +278,7 @@ template<> struct mp_for_index_impl_<13> } }; -template<> struct mp_for_index_impl_<14> +template<> struct mp_with_index_impl_<14> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -302,7 +302,7 @@ template<> struct mp_for_index_impl_<14> } }; -template<> struct mp_for_index_impl_<15> +template<> struct mp_with_index_impl_<15> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -327,7 +327,7 @@ template<> struct mp_for_index_impl_<15> } }; -template<> struct mp_for_index_impl_<16> +template<> struct mp_with_index_impl_<16> { template static BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) call( std::size_t i, F && f ) { @@ -355,15 +355,15 @@ template<> struct mp_for_index_impl_<16> } // namespace detail -template inline BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) mp_for_index( std::size_t i, F && f ) +template inline BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) mp_with_index( std::size_t i, F && f ) { assert( i < N ); - return detail::mp_for_index_impl_::template call<0>( i, std::forward(f) ); + return detail::mp_with_index_impl_::template call<0>( i, std::forward(f) ); } -template inline BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) mp_for_index( std::size_t i, F && f ) +template inline BOOST_MP11_CONSTEXPR14 decltype(std::declval()(std::declval>())) mp_with_index( std::size_t i, F && f ) { - return mp_for_index( i, std::forward(f) ); + return mp_with_index( i, std::forward(f) ); } #undef BOOST_MP11_CONSTEXPR14 @@ -371,4 +371,4 @@ template inline BOOST_MP11_CONSTEXPR14 decltype(std::declval( i, F(i) ); - mp_for_index>( i, F(i) ); + mp_with_index( i, F(i) ); + mp_with_index>( i, F(i) ); } } }; diff --git a/test/mp_for_index_cx.cpp b/test/mp_with_index_cx.cpp similarity index 88% rename from test/mp_for_index_cx.cpp rename to test/mp_with_index_cx.cpp index db8d180..97fdcc4 100644 --- a/test/mp_for_index_cx.cpp +++ b/test/mp_with_index_cx.cpp @@ -20,7 +20,7 @@ int main() {} #include using boost::mp11::mp_size_t; -using boost::mp11::mp_for_index; +using boost::mp11::mp_with_index; struct F { @@ -34,7 +34,7 @@ struct F int main() { - constexpr std::size_t i = mp_for_index<64>( 57, F{} ); + constexpr std::size_t i = mp_with_index<64>( 57, F{} ); STATIC_ASSERT( i == 57 ); }