/*============================================================================= 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_SUB_ARRAY_SUB_WINDOW_HPP #define SPROUT_SUB_ARRAY_SUB_WINDOW_HPP #include #include #include #include #include #include namespace sprout { // // sub_window // template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type sub_window( Container& arr, typename sprout::container_traits >::difference_type to_first, typename sprout::container_traits >::difference_type to_last ) { return sprout::sub_array(arr, to_first, to_last); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type sub_window( Container& arr, typename sprout::container_traits >::difference_type to_first = 0 ) { return sprout::sub_array(arr, to_first, sprout::size(arr)); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type sub_window( Container const& arr, typename sprout::container_traits >::difference_type to_first, typename sprout::container_traits >::difference_type to_last ) { return sprout::sub_array(arr, to_first, to_last); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type sub_window( Container const& arr, typename sprout::container_traits >::difference_type to_first = 0 ) { return sprout::sub_array(arr, to_first, sprout::size(arr)); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, Container>::type sub_window( Container const& arr, typename sprout::container_traits::difference_type to_first, typename sprout::container_traits::difference_type to_last ) { return Container(arr, to_first, to_last); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, Container>::type sub_window( Container const& arr, typename sprout::container_traits::difference_type to_first = 0 ) { return Container(arr, to_first, sprout::size(arr)); } // // csub_window // template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type csub_window( Container const& arr, typename sprout::container_traits >::difference_type to_first, typename sprout::container_traits >::difference_type to_last ) { return sprout::sub_window(arr, to_first, to_last); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type csub_window( Container const& arr, typename sprout::container_traits >::difference_type to_first = 0 ) { return sprout::sub_window(arr, to_first, sprout::size(arr)); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type csub_window( Container const& arr, typename sprout::container_traits::difference_type to_first, typename sprout::container_traits::difference_type to_last ) { return sprout::sub_array( arr.get_array(), arr.to_first() + to_first, arr.to_first() + to_last ); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type csub_window( Container const& arr, typename sprout::container_traits::difference_type to_first = 0 ) { return sprout::sub_array( arr.get_array(), arr.to_first() + to_first, arr.to_first() + sprout::size(arr) ); } // // sub_window_copy // template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type sub_window_copy( Container const& arr, typename sprout::container_traits::difference_type to_first, typename sprout::container_traits::difference_type to_last ) { return sprout::sub_array(arr, to_first, to_last); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type sub_window_copy( Container const& arr, typename sprout::container_traits::difference_type to_first = 0 ) { return sprout::sub_array(arr, to_first, sprout::size(arr)); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type sub_window_copy( Container const& arr, typename sprout::container_traits::difference_type to_first, typename sprout::container_traits::difference_type to_last ) { return sprout::sub_array( arr.get_array(), arr.to_first() + to_first, arr.to_first() + to_last ); } template inline SPROUT_CONSTEXPR typename std::enable_if::value, sprout::sub_array >::type sub_window_copy( Container const& arr, typename sprout::container_traits::difference_type to_first = 0 ) { return sprout::sub_array( arr.get_array(), arr.to_first() + to_first, arr.to_first() + sprout::size(arr) ); } } // namespace sprout #endif // #ifndef SPROUT_SUB_ARRAY_SUB_WINDOW_HPP