diff --git a/sprout/adapt/std/array.hpp b/sprout/adapt/std/array.hpp new file mode 100644 index 00000000..c6b716bf --- /dev/null +++ b/sprout/adapt/std/array.hpp @@ -0,0 +1,10 @@ +#ifndef SPROUT_ADAPT_STD_ARRAY_HPP +#define SPROUT_ADAPT_STD_ARRAY_HPP + +#include +#include +#include +#include +#include + +#endif // #ifndef SPROUT_ADAPT_STD_ARRAY_HPP diff --git a/sprout/adapt/std/utility.hpp b/sprout/adapt/std/utility.hpp new file mode 100644 index 00000000..4a549775 --- /dev/null +++ b/sprout/adapt/std/utility.hpp @@ -0,0 +1,9 @@ +#ifndef SPROUT_ADAPT_SSCRISK_CEL_UTILITY_HPP +#define SPROUT_ADAPT_SSCRISK_CEL_UTILITY_HPP + +#include +#include +#include +#include + +#endif // #ifndef SPROUT_ADAPT_SSCRISK_CEL_UTILITY_HPP diff --git a/sprout/container/std/array.hpp b/sprout/container/std/array.hpp new file mode 100644 index 00000000..53535866 --- /dev/null +++ b/sprout/container/std/array.hpp @@ -0,0 +1,59 @@ +#ifndef SPROUT_CONTAINER_STD_ARRAY_HPP +#define SPROUT_CONTAINER_STD_ARRAY_HPP + +#include +#include +#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION +# include +# include +# include +# include +#endif + +#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION +namespace sprout { + // + // container_traits + // + template + struct container_traits > + : public sprout::detail::container_traits_default > + { + public: + typedef sprout::index_iterator&, true> iterator; + typedef sprout::index_iterator const&, true> const_iterator; + }; +} // namespace sprout + +namespace sprout { + // + // range_begin + // + template + inline typename sprout::container_traits >::iterator + range_begin(std::array& cont) { + return typename sprout::container_traits >::iterator(cont, 0); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits >::const_iterator + range_begin(std::array const& cont) { + return typename sprout::container_traits >::const_iterator(cont, 0); + } + + // + // range_end + // + template + inline typename sprout::container_traits >::iterator + range_end(std::array& cont) { + return typename sprout::container_traits >::iterator(cont, cont.size()); + } + template + inline SPROUT_CONSTEXPR typename sprout::container_traits >::const_iterator + range_end(std::array const& cont) { + return typename sprout::container_traits >::const_iterator(cont, cont.size()); + } +} // namespace sprout +#endif + +#endif // #ifndef SPROUT_CONTAINER_STD_ARRAY_HPP diff --git a/sprout/functional/hash/sscrisk/cel/array.hpp b/sprout/functional/hash/sscrisk/cel/array.hpp index 87f0fc5a..1ee76cf3 100644 --- a/sprout/functional/hash/sscrisk/cel/array.hpp +++ b/sprout/functional/hash/sscrisk/cel/array.hpp @@ -2,9 +2,9 @@ #define SPROUT_FUNCTIONAL_HASH_SSCRISK_CEL_ARRAY_HPP #include +#include #include #include -#include namespace sprout { // diff --git a/sprout/functional/hash/sscrisk/cel/utility.hpp b/sprout/functional/hash/sscrisk/cel/utility.hpp index 15919f75..3d1b1130 100644 --- a/sprout/functional/hash/sscrisk/cel/utility.hpp +++ b/sprout/functional/hash/sscrisk/cel/utility.hpp @@ -2,9 +2,9 @@ #define SPROUT_FUNCTIONAL_HASH_SSCRISK_CEL_UTILITY_HPP #include +#include #include #include -#include namespace sprout { // diff --git a/sprout/functional/hash/std/array.hpp b/sprout/functional/hash/std/array.hpp new file mode 100644 index 00000000..39a2cddb --- /dev/null +++ b/sprout/functional/hash/std/array.hpp @@ -0,0 +1,20 @@ +#ifndef SPROUT_FUNCTIONAL_HASH_STD_ARRAY_HPP +#define SPROUT_FUNCTIONAL_HASH_STD_ARRAY_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // hash_value + // + template + inline SPROUT_CONSTEXPR std::size_t + hash_value(std::array const& v) { + return sprout::hash_range(v); + } +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_HASH_STD_ARRAY_HPP diff --git a/sprout/functional/hash/std/utility.hpp b/sprout/functional/hash/std/utility.hpp new file mode 100644 index 00000000..f886a7fa --- /dev/null +++ b/sprout/functional/hash/std/utility.hpp @@ -0,0 +1,20 @@ +#ifndef SPROUT_FUNCTIONAL_HASH_STD_UTILITY_HPP +#define SPROUT_FUNCTIONAL_HASH_STD_UTILITY_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // hash_value + // + template + inline SPROUT_CONSTEXPR std::size_t + hash_value(std::pair const& v) { + return sprout::hash_values(v.first, v.second); + } +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_HASH_STD_UTILITY_HPP diff --git a/sprout/tuple/std/array.hpp b/sprout/tuple/std/array.hpp new file mode 100644 index 00000000..3ac6b824 --- /dev/null +++ b/sprout/tuple/std/array.hpp @@ -0,0 +1,34 @@ +#ifndef SPROUT_TUPLE_STD_ARRAY_HPP +#define SPROUT_TUPLE_STD_ARRAY_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout_adl { + // + // tuple_get + // + template + inline SPROUT_CONSTEXPR T& + tuple_get(std::array& t) SPROUT_NOEXCEPT { + static_assert(I < N, "tuple_get: index out of range"); + return t[I]; + } + template + inline SPROUT_CONSTEXPR T const& + tuple_get(std::array const& t) SPROUT_NOEXCEPT { + static_assert(I < N, "tuple_get: index out of range"); + return t[I]; + } + template + inline SPROUT_CONSTEXPR T&& + tuple_get(std::array&& t) SPROUT_NOEXCEPT { + return sprout::move(sprout::tuples::get(t)); + } +} // namespace sprout_adl + +#endif // #ifndef SPROUT_TUPLE_STD_ARRAY_HPP diff --git a/sprout/tuple/std/utility.hpp b/sprout/tuple/std/utility.hpp new file mode 100644 index 00000000..335d5fe2 --- /dev/null +++ b/sprout/tuple/std/utility.hpp @@ -0,0 +1,64 @@ +#ifndef SPROUT_TUPLE_STD_UTILITY_HPP +#define SPROUT_TUPLE_STD_UTILITY_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace tuples { + namespace detail { + template + struct get_impl; + template + struct get_impl<0, std::pair > { + public: + SPROUT_CONSTEXPR T1& operator()(std::pair& t) const { + return t.first; + } + SPROUT_CONSTEXPR T1 const& operator()(std::pair const& t) const { + return t.first; + } + }; + template + struct get_impl<1, std::pair > { + public: + public: + SPROUT_CONSTEXPR T2& operator()(std::pair& t) const { + return t.second; + } + SPROUT_CONSTEXPR T2 const& operator()(std::pair const& t) const { + return t.second; + } + }; + } // namespace detail + } // namespace tuples +} // namespace sprout + +namespace sprout_adl { + // + // tuple_get + // + template + inline SPROUT_CONSTEXPR typename sprout::tuples::tuple_element >::type& + tuple_get(std::pair& t) SPROUT_NOEXCEPT { + static_assert(I < 2, "tuple_get: index out of range"); + return sprout::tuples::detail::get_impl >()(t); + } + template + inline SPROUT_CONSTEXPR typename sprout::tuples::tuple_element >::type const& + tuple_get(std::pair const& t) SPROUT_NOEXCEPT { + static_assert(I < 2, "tuple_get: index out of range"); + return sprout::tuples::detail::get_impl >()(t); + } + template + inline SPROUT_CONSTEXPR typename sprout::tuples::tuple_element >::type&& + tuple_get(std::pair&& t) SPROUT_NOEXCEPT { + return sprout::move(sprout::tuples::get(t)); + } +} // namespace sprout_adl + +#endif // #ifndef SPROUT_TUPLE_STD_UTILITY_HPP