#ifndef SPROUT_OPERATION_FIXED_ERASE_HPP #define SPROUT_OPERATION_FIXED_ERASE_HPP #include #include #include #include #include namespace sprout { namespace fixed { namespace result_of { // // erase // template struct erase { static_assert(sprout::container_traits::static_size >= 1, "static_size >= 1"); public: typedef typename sprout::container_transform_traits< Container >::template rebind_size< sprout::container_traits::static_size - 1 >::type type; }; } // namespace result_of namespace detail { template inline SPROUT_CONSTEXPR Result erase_impl( Container const& cont, sprout::index_tuple, typename sprout::container_traits::difference_type pos ) { return sprout::remake( cont, sprout::size(cont) - 1, (Indexes < sprout::container_traits::static_size - 1 ? (Indexes < pos ? *sprout::next(sprout::internal_begin(cont), Indexes) : *sprout::next(sprout::internal_begin(cont), Indexes + 1) ) : typename sprout::container_traits::value_type() )... ); } } // namespace detail // // erase // template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::erase::type erase(Container const& cont, typename sprout::container_traits::const_iterator pos) { return sprout::fixed::detail::erase_impl::type>( cont, sprout::index_range< 0, sprout::container_traits::type>::static_size >::make(), sprout::distance(sprout::internal_begin(cont), pos) ); } // // erase // template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::erase::type erase(Container const& cont, typename sprout::container_traits::difference_type pos) { return sprout::fixed::detail::erase_impl::type>( cont, sprout::index_range< 0, sprout::container_traits::type>::static_size >::make(), sprout::distance(sprout::internal_begin(cont), sprout::next(sprout::begin(cont), pos)) ); } } // namespace fixed namespace result_of { using sprout::fixed::result_of::erase; } // namespace result_of using sprout::fixed::erase; } // namespace sprout #endif // #ifndef SPROUT_OPERATION_FIXED_ERASE_HPP