From 40036a4c05cb58d430f595402c3013d3ba5e84a2 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Mon, 31 Oct 2011 20:30:08 +0900 Subject: [PATCH] =?UTF-8?q?std::get=20=E3=81=AE=E3=82=AA=E3=83=BC=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=83=AD=E3=83=BC=E3=83=89=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sprout/array.hpp | 18 --------------- sprout/pit.hpp | 27 ---------------------- sprout/string.hpp | 18 --------------- sprout/sub_array.hpp | 27 ---------------------- sprout/tuple/array.hpp | 1 + sprout/tuple/pit.hpp | 44 ++++++++++++++++++++++++++++++++++++ sprout/tuple/string.hpp | 1 + sprout/tuple/sub_array.hpp | 46 ++++++++++++++++++++++++++++++++++++++ sprout/tuple/uuid.hpp | 3 ++- sprout/uuid/uuid.hpp | 18 --------------- 10 files changed, 94 insertions(+), 109 deletions(-) create mode 100644 sprout/tuple/pit.hpp create mode 100644 sprout/tuple/sub_array.hpp diff --git a/sprout/array.hpp b/sprout/array.hpp index d1c29fc4..e3c3e150 100644 --- a/sprout/array.hpp +++ b/sprout/array.hpp @@ -324,24 +324,6 @@ namespace std { static_assert(I < N, "tuple_element<>: index out of range"); typedef T type; }; - - // - // get - // - template - T& get(sprout::array& t) SPROUT_NOEXCEPT { - static_assert(I < N, "get: index out of range"); - return t[I]; - } - template - SPROUT_CONSTEXPR T const& get(sprout::array const& t) SPROUT_NOEXCEPT { - static_assert(I < N, "get: index out of range"); - return t[I]; - } - template - T&& get(sprout::array&& t) SPROUT_NOEXCEPT { - return std::move(std::get(t)); - } } // namespace std #endif // #ifndef SPROUT_ARRAY_HPP diff --git a/sprout/pit.hpp b/sprout/pit.hpp index e61b5816..d41c0b38 100644 --- a/sprout/pit.hpp +++ b/sprout/pit.hpp @@ -279,33 +279,6 @@ namespace std { static_assert(I < sprout::fixed_container_traits >::fixed_size, "tuple_element<>: index out of range"); typedef typename sprout::fixed_container_traits >::value_type type; }; - - // - // get - // - template - typename sprout::fixed_container_traits >::value_type& get( - sprout::pit& t - ) SPROUT_NOEXCEPT - { - static_assert(I < sprout::fixed_container_traits >::fixed_size, "get: index out of range"); - return t[I]; - } - template - SPROUT_CONSTEXPR typename sprout::fixed_container_traits >::value_type const& get( - sprout::pit const& t - ) SPROUT_NOEXCEPT - { - static_assert(I < sprout::fixed_container_traits >::fixed_size, "get: index out of range"); - return t[I]; - } - template - typename sprout::fixed_container_traits >::value_type&& get( - sprout::pit&& t - ) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::move(std::get(t)))) - { - return std::move(std::get(t)); - } } // namespace std #endif // #ifndef SPROUT_PIT_HPP diff --git a/sprout/string.hpp b/sprout/string.hpp index 806c12c9..fb2f3adc 100644 --- a/sprout/string.hpp +++ b/sprout/string.hpp @@ -1062,24 +1062,6 @@ namespace std { static_assert(I < N, "tuple_element<>: index out of range"); typedef T type; }; - - // - // get - // - template - T& get(sprout::basic_string& t) SPROUT_NOEXCEPT { - static_assert(I < N, "get: index out of range"); - return t[I]; - } - template - SPROUT_CONSTEXPR T const& get(sprout::basic_string const& t) SPROUT_NOEXCEPT { - static_assert(I < N, "get: index out of range"); - return t[I]; - } - template - T&& get(sprout::basic_string&& t) SPROUT_NOEXCEPT { - return std::move(std::get(t)); - } } // namespace std #endif // #ifndef SPROUT_STRING_HPP diff --git a/sprout/sub_array.hpp b/sprout/sub_array.hpp index 0a047897..c4d7a6fb 100644 --- a/sprout/sub_array.hpp +++ b/sprout/sub_array.hpp @@ -942,33 +942,6 @@ namespace std { >::type >::type type; }; - - // - // get - // - template - typename sprout::fixed_container_traits >::value_type& get( - sprout::sub_array& t - ) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(*sprout::next(sprout::fixed_begin(t), I))) - { - static_assert(I < sprout::fixed_container_traits >::fixed_size, "get: index out of range"); - return *sprout::next(sprout::fixed_begin(t), I); - } - template - SPROUT_CONSTEXPR typename sprout::fixed_container_traits >::value_type const& get( - sprout::sub_array const& t - ) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(*sprout::next(sprout::fixed_begin(t), I))) - { - static_assert(I < sprout::fixed_container_traits >::fixed_size, "get: index out of range"); - return *sprout::next(sprout::fixed_begin(t), I); - } - template - typename sprout::fixed_container_traits >::value_type&& get( - sprout::sub_array&& t - ) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::move(std::get(t)))) - { - return std::move(std::get(t)); - } } // namespace std #endif // #ifndef SPROUT_SUB_ARRAY_HPP diff --git a/sprout/tuple/array.hpp b/sprout/tuple/array.hpp index b514e5e1..f191386d 100644 --- a/sprout/tuple/array.hpp +++ b/sprout/tuple/array.hpp @@ -2,6 +2,7 @@ #define SPROUT_TUPLE_ARRAY_HPP #include +#include #include #include #include diff --git a/sprout/tuple/pit.hpp b/sprout/tuple/pit.hpp new file mode 100644 index 00000000..c680434f --- /dev/null +++ b/sprout/tuple/pit.hpp @@ -0,0 +1,44 @@ +#ifndef SPROUT_TUPLE_PIT_HPP +#define SPROUT_TUPLE_PIT_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace tuples { + // + // get + // + template + typename sprout::fixed_container_traits >::value_type& get( + sprout::pit& t + ) SPROUT_NOEXCEPT + { + static_assert(I < sprout::fixed_container_traits >::fixed_size, "get: index out of range"); + return t[I]; + } + template + SPROUT_CONSTEXPR typename sprout::fixed_container_traits >::value_type const& get( + sprout::pit const& t + ) SPROUT_NOEXCEPT + { + static_assert(I < sprout::fixed_container_traits >::fixed_size, "get: index out of range"); + return t[I]; + } + template + typename sprout::fixed_container_traits >::value_type&& get( + sprout::pit&& t + ) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::move(sprout::tuples::get(t)))) + { + return std::move(sprout::tuples::get(t)); + } + } // namespace tuples + + using sprout::tuples::get; +} // namespace sprout + +#endif // #ifndef SPROUT_TUPLE_PIT_HPP diff --git a/sprout/tuple/string.hpp b/sprout/tuple/string.hpp index a0d599ae..a10ab9ee 100644 --- a/sprout/tuple/string.hpp +++ b/sprout/tuple/string.hpp @@ -2,6 +2,7 @@ #define SPROUT_TUPLE_STRING_HPP #include +#include #include #include #include diff --git a/sprout/tuple/sub_array.hpp b/sprout/tuple/sub_array.hpp new file mode 100644 index 00000000..a5b90938 --- /dev/null +++ b/sprout/tuple/sub_array.hpp @@ -0,0 +1,46 @@ +#ifndef SPROUT_TUPLE_SUB_ARRAY_HPP +#define SPROUT_TUPLE_SUB_ARRAY_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace tuples { + // + // get + // + template + typename sprout::fixed_container_traits >::value_type& get( + sprout::sub_array& t + ) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(*sprout::next(sprout::fixed_begin(t), I))) + { + static_assert(I < sprout::fixed_container_traits >::fixed_size, "get: index out of range"); + return *sprout::next(sprout::fixed_begin(t), I); + } + template + SPROUT_CONSTEXPR typename sprout::fixed_container_traits >::value_type const& get( + sprout::sub_array const& t + ) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(*sprout::next(sprout::fixed_begin(t), I))) + { + static_assert(I < sprout::fixed_container_traits >::fixed_size, "get: index out of range"); + return *sprout::next(sprout::fixed_begin(t), I); + } + template + typename sprout::fixed_container_traits >::value_type&& get( + sprout::sub_array&& t + ) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::move(sprout::tuples::get(t)))) + { + return std::move(sprout::tuples::get(t)); + } + } // namespace tuples + + using sprout::tuples::get; +} // namespace sprout + +#endif // #ifndef SPROUT_TUPLE_SUB_ARRAY_HPP diff --git a/sprout/tuple/uuid.hpp b/sprout/tuple/uuid.hpp index 2a43d1b5..75c709cc 100644 --- a/sprout/tuple/uuid.hpp +++ b/sprout/tuple/uuid.hpp @@ -2,6 +2,7 @@ #define SPROUT_TUPLE_UUID_HPP #include +#include #include #include #include @@ -24,7 +25,7 @@ namespace sprout { } template sprout::uuids::uuid::value_type&& get(sprout::uuids::uuid&& t) SPROUT_NOEXCEPT { - return std::move(std::get(t)); + return std::move(sprout::tuples::get(t)); } } // namespace tuples diff --git a/sprout/uuid/uuid.hpp b/sprout/uuid/uuid.hpp index 8b7b145e..1067c1b3 100644 --- a/sprout/uuid/uuid.hpp +++ b/sprout/uuid/uuid.hpp @@ -280,24 +280,6 @@ namespace std { static_assert(I < 16, "tuple_element<>: index out of range"); typedef sprout::uuids::uuid::value_type type; }; - - // - // get - // - template - sprout::uuids::uuid::value_type& get(sprout::uuids::uuid& t) SPROUT_NOEXCEPT { - static_assert(I < 16, "get: index out of range"); - return t[I]; - } - template - SPROUT_CONSTEXPR sprout::uuids::uuid::value_type const& get(sprout::uuids::uuid const& t) SPROUT_NOEXCEPT { - static_assert(I < 16, "get: index out of range"); - return t[I]; - } - template - sprout::uuids::uuid::value_type&& get(sprout::uuids::uuid&& t) SPROUT_NOEXCEPT { - return std::move(std::get(t)); - } } // namespace std #endif // #ifndef SPROUT_UUID_UUID_HPP