/*============================================================================= Copyright (c) 2011-2013 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 result_of { // // set // template struct set { public: typedef typename sprout::container_construct_traits::copied_type type; }; } // namespace result_of 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::result_of::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::result_of::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 result_of { using sprout::fixed::result_of::set; } // namespace result_of using sprout::fixed::set; } // namespace sprout #endif // #ifndef SPROUT_OPERATION_FIXED_SET_HPP