/*============================================================================= Copyright (c) 2011-2018 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_OPERATION_FIXED_SET_HPP #define SPROUT_OPERATION_FIXED_SET_HPP #include #include #include #include #include #include namespace sprout { namespace fixed { namespace results { // // set // template struct set { public: typedef typename sprout::container_construct_traits::copied_type type; }; } // namespace results namespace detail { template inline SPROUT_CONSTEXPR Result set_impl( Container const& cont, sprout::index_tuple, typename sprout::container_traits::difference_type pos, T const& v ) { return sprout::remake( cont, sprout::size(cont), (Indexes != pos ? *sprout::next(sprout::internal_begin(cont), Indexes) : v )... ); } } // namespace detail // // set // template inline SPROUT_CONSTEXPR typename sprout::fixed::results::set::type set(Container const& cont, typename sprout::container_traits::const_iterator pos, T const& v) { return sprout::fixed::detail::set_impl::type>( cont, sprout::container_indexes::type>::make(), sprout::distance(sprout::internal_begin(cont), pos), v ); } template inline SPROUT_CONSTEXPR typename sprout::fixed::results::set::type set(Container const& cont, typename sprout::container_traits::difference_type pos, T const& v) { return sprout::fixed::detail::set_impl::type>( cont, sprout::container_indexes::type>::make(), sprout::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)), v ); } } // namespace fixed namespace results { using sprout::fixed::results::set; } // namespace results using sprout::fixed::set; } // namespace sprout #endif // #ifndef SPROUT_OPERATION_FIXED_SET_HPP