/*============================================================================= Copyright (c) 2011-2019 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef SPROUT_SIZED_PIT_CONTAINER_HPP #define SPROUT_SIZED_PIT_CONTAINER_HPP #include #include #include #include #include namespace sprout { namespace detail { template struct sized_pit_container_construct_traits; template struct sized_pit_container_construct_traits< sprout::sized_pit, typename std::enable_if::value>::type > { public: typedef typename sprout::container_construct_traits::copied_type copied_type; public: template static SPROUT_CONSTEXPR copied_type deep_copy(Cont&&) { return copied_type(); } template static SPROUT_CONSTEXPR copied_type make(Args&&... args) { return sprout::make(SPROUT_FORWARD(Args, args)...); } template static SPROUT_CONSTEXPR copied_type remake(Cont&& cont, typename sprout::container_traits >::difference_type size, Args&&... args) { return sprout::remake(SPROUT_FORWARD(Cont, cont), size, SPROUT_FORWARD(Args, args)...); } }; template struct sized_pit_container_construct_traits< sprout::sized_pit, typename std::enable_if::value>::type > { public: typedef typename sprout::container_construct_traits::copied_type copied_type; public: template static SPROUT_CONSTEXPR copied_type deep_copy(Cont&&) { return copied_type(); } template static SPROUT_CONSTEXPR copied_type make(Args&&... args) { return sprout::make(SPROUT_FORWARD(Args, args)...); } template static SPROUT_CONSTEXPR copied_type remake(Cont&& cont, typename sprout::container_traits >::difference_type size, Args&&... args) { return sprout::remake(SPROUT_FORWARD(Cont, cont), size, SPROUT_FORWARD(Args, args)...); } template static SPROUT_CONSTEXPR copied_type remake(Cont&&, typename sprout::container_traits >::difference_type, InputIterator first, InputIterator last) { return copied_type(first, last); } }; } // namespace detail // // container_construct_traits // template struct container_construct_traits > : public sprout::detail::sized_pit_container_construct_traits > {}; // // container_transform_traits // template struct container_transform_traits > { public: template >::size_type Size> struct rebind_size { public: typedef sprout::sized_pit< typename sprout::container_transform_traits::template rebind_size::type > type; }; template struct rebind_type { public: typedef sprout::sized_pit< typename sprout::container_transform_traits::template rebind_type::type > type; }; }; } // namespace sprout #endif // #ifndef SPROUT_SIZED_PIT_CONTAINER_HPP