diff --git a/sprout/compost/effects.hpp b/sprout/compost/effects.hpp index 14af34a4..adda7b9d 100644 --- a/sprout/compost/effects.hpp +++ b/sprout/compost/effects.hpp @@ -2,18 +2,20 @@ #define SPROUT_COMPOST_EFFECTS_HPP #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include +#include +#include +#include +#include #endif // #ifndef SPROUT_COMPOST_EFFECTS_HPP diff --git a/sprout/compost/effects/change_volume.hpp b/sprout/compost/effects/changed_volume.hpp similarity index 88% rename from sprout/compost/effects/change_volume.hpp rename to sprout/compost/effects/changed_volume.hpp index d13863dd..cbefe829 100644 --- a/sprout/compost/effects/change_volume.hpp +++ b/sprout/compost/effects/changed_volume.hpp @@ -1,5 +1,5 @@ -#ifndef SPROUT_COMPOST_EFFECTS_CHANGE_VOLUME_HPP -#define SPROUT_COMPOST_EFFECTS_CHANGE_VOLUME_HPP +#ifndef SPROUT_COMPOST_EFFECTS_CHANGED_VOLUME_HPP +#define SPROUT_COMPOST_EFFECTS_CHANGED_VOLUME_HPP #include #include @@ -68,4 +68,4 @@ namespace sprout { } // namespace compost } // namespace sprout -#endif // #ifndef SPROUT_COMPOST_EFFECTS_CHANGE_VOLUME_HPP +#endif // #ifndef SPROUT_COMPOST_EFFECTS_CHANGED_VOLUME_HPP diff --git a/sprout/compost/effects/clip.hpp b/sprout/compost/effects/clipped.hpp similarity index 89% rename from sprout/compost/effects/clip.hpp rename to sprout/compost/effects/clipped.hpp index 37e6b38f..a66e2fa6 100644 --- a/sprout/compost/effects/clip.hpp +++ b/sprout/compost/effects/clipped.hpp @@ -1,5 +1,5 @@ -#ifndef SPROUT_COMPOST_EFFECTS_CLIP_HPP -#define SPROUT_COMPOST_EFFECTS_CLIP_HPP +#ifndef SPROUT_COMPOST_EFFECTS_CLIPPED_HPP +#define SPROUT_COMPOST_EFFECTS_CLIPPED_HPP #include #include @@ -82,4 +82,4 @@ namespace sprout { } // namespace compost } // namespace sprout -#endif // #ifndef SPROUT_COMPOST_EFFECTS_CLIP_HPP +#endif // #ifndef SPROUT_COMPOST_EFFECTS_CLIPPED_HPP diff --git a/sprout/compost/effects/compress.hpp b/sprout/compost/effects/compressed.hpp similarity index 92% rename from sprout/compost/effects/compress.hpp rename to sprout/compost/effects/compressed.hpp index 86c8a724..7621c4e7 100644 --- a/sprout/compost/effects/compress.hpp +++ b/sprout/compost/effects/compressed.hpp @@ -1,5 +1,5 @@ -#ifndef SPROUT_COMPOST_EFFECTS_COMPRESS_HPP -#define SPROUT_COMPOST_EFFECTS_COMPRESS_HPP +#ifndef SPROUT_COMPOST_EFFECTS_COMPRESEDS_HPP +#define SPROUT_COMPOST_EFFECTS_COMPRESEDS_HPP #include #include @@ -123,4 +123,4 @@ namespace sprout { } // namespace compost } // namespace sprout -#endif // #ifndef SPROUT_COMPOST_EFFECTS_COMPRESS_HPP +#endif // #ifndef SPROUT_COMPOST_EFFECTS_COMPRESEDS_HPP diff --git a/sprout/compost/effects/copied.hpp b/sprout/compost/effects/copied.hpp new file mode 100644 index 00000000..ed975a65 --- /dev/null +++ b/sprout/compost/effects/copied.hpp @@ -0,0 +1,20 @@ +#ifndef SPROUT_COMPOST_EFFECTS_COPIED_HPP +#define SPROUT_COMPOST_EFFECTS_COPIED_HPP + +#include +#include + +namespace sprout { + namespace compost { + namespace effects { + // + // copied + // + namespace { + SPROUT_STATIC_CONSTEXPR sprout::adaptors::copied_forwarder copied{}; + } // anonymous-namespace + } // namespace effects + } // namespace compost +} // namespace sprout + +#endif // #ifndef SPROUT_COMPOST_EFFECTS_COPIED_HPP diff --git a/sprout/compost/effects/distort.hpp b/sprout/compost/effects/distorted.hpp similarity index 85% rename from sprout/compost/effects/distort.hpp rename to sprout/compost/effects/distorted.hpp index f6977655..ebe00376 100644 --- a/sprout/compost/effects/distort.hpp +++ b/sprout/compost/effects/distorted.hpp @@ -1,10 +1,10 @@ -#ifndef SPROUT_COMPOST_EFFECTS_DISTORT_HPP -#define SPROUT_COMPOST_EFFECTS_DISTORT_HPP +#ifndef SPROUT_COMPOST_EFFECTS_DISTORTED_HPP +#define SPROUT_COMPOST_EFFECTS_DISTORTED_HPP #include #include -#include -#include +#include +#include namespace sprout { namespace compost { @@ -75,4 +75,4 @@ namespace sprout { } // namespace compost } // namespace sprout -#endif // #ifndef SPROUT_COMPOST_EFFECTS_DISTORT_HPP +#endif // #ifndef SPROUT_COMPOST_EFFECTS_DISTORTED_HPP diff --git a/sprout/compost/effects/fuzz.hpp b/sprout/compost/effects/fuzzed.hpp similarity index 84% rename from sprout/compost/effects/fuzz.hpp rename to sprout/compost/effects/fuzzed.hpp index b8b1c513..94e5feac 100644 --- a/sprout/compost/effects/fuzz.hpp +++ b/sprout/compost/effects/fuzzed.hpp @@ -1,11 +1,11 @@ -#ifndef SPROUT_COMPOST_EFFECTS_FUZZ_HPP -#define SPROUT_COMPOST_EFFECTS_FUZZ_HPP +#ifndef SPROUT_COMPOST_EFFECTS_FUZZED_HPP +#define SPROUT_COMPOST_EFFECTS_FUZZED_HPP #include #include #include -#include -#include +#include +#include namespace sprout { namespace compost { @@ -74,4 +74,4 @@ namespace sprout { } // namespace compost } // namespace sprout -#endif // #ifndef SPROUT_COMPOST_EFFECTS_FUZZ_HPP +#endif // #ifndef SPROUT_COMPOST_EFFECTS_FUZZED_HPP diff --git a/sprout/compost/effects/jointed.hpp b/sprout/compost/effects/jointed.hpp new file mode 100644 index 00000000..0b43c92a --- /dev/null +++ b/sprout/compost/effects/jointed.hpp @@ -0,0 +1,20 @@ +#ifndef SPROUT_COMPOST_EFFECTS_JOINTED_HPP +#define SPROUT_COMPOST_EFFECTS_JOINTED_HPP + +#include +#include + +namespace sprout { + namespace compost { + namespace effects { + // + // jointed + // + namespace { + SPROUT_STATIC_CONSTEXPR sprout::adaptors::jointed_forwarder jointed{}; + } // anonymous-namespace + } // namespace effects + } // namespace compost +} // namespace sprout + +#endif // #ifndef SPROUT_COMPOST_EFFECTS_JOINTED_HPP diff --git a/sprout/compost/effects/noise_gate.hpp b/sprout/compost/effects/noise_gated.hpp similarity index 91% rename from sprout/compost/effects/noise_gate.hpp rename to sprout/compost/effects/noise_gated.hpp index e6eff75e..1301f601 100644 --- a/sprout/compost/effects/noise_gate.hpp +++ b/sprout/compost/effects/noise_gated.hpp @@ -1,5 +1,5 @@ -#ifndef SPROUT_COMPOST_EFFECTS_NOISE_GATE_HPP -#define SPROUT_COMPOST_EFFECTS_NOISE_GATE_HPP +#ifndef SPROUT_COMPOST_EFFECTS_NOISE_GATED_HPP +#define SPROUT_COMPOST_EFFECTS_NOISE_GATED_HPP #include #include @@ -113,4 +113,4 @@ namespace sprout { } // namespace compost } // namespace sprout -#endif // #ifndef SPROUT_COMPOST_EFFECTS_NOISE_GATE_HPP +#endif // #ifndef SPROUT_COMPOST_EFFECTS_NOISE_GATED_HPP diff --git a/sprout/compost/effects/overdrive.hpp b/sprout/compost/effects/overdrived.hpp similarity index 89% rename from sprout/compost/effects/overdrive.hpp rename to sprout/compost/effects/overdrived.hpp index c7363e6e..ffabd17c 100644 --- a/sprout/compost/effects/overdrive.hpp +++ b/sprout/compost/effects/overdrived.hpp @@ -1,12 +1,12 @@ -#ifndef SPROUT_COMPOST_EFFECTS_OVERDRIVE_HPP -#define SPROUT_COMPOST_EFFECTS_OVERDRIVE_HPP +#ifndef SPROUT_COMPOST_EFFECTS_OVERDRIVED_HPP +#define SPROUT_COMPOST_EFFECTS_OVERDRIVED_HPP #include #include #include #include #include -#include +#include namespace sprout { namespace compost { @@ -103,4 +103,4 @@ namespace sprout { } // namespace compost } // namespace sprout -#endif // #ifndef SPROUT_COMPOST_EFFECTS_OVERDRIVE_HPP +#endif // #ifndef SPROUT_COMPOST_EFFECTS_OVERDRIVED_HPP diff --git a/sprout/compost/effects/rectify.hpp b/sprout/compost/effects/rectified.hpp similarity index 86% rename from sprout/compost/effects/rectify.hpp rename to sprout/compost/effects/rectified.hpp index 10b2cabb..622e6812 100644 --- a/sprout/compost/effects/rectify.hpp +++ b/sprout/compost/effects/rectified.hpp @@ -1,5 +1,5 @@ -#ifndef SPROUT_COMPOST_EFFECTS_RECTIFY_HPP -#define SPROUT_COMPOST_EFFECTS_RECTIFY_HPP +#ifndef SPROUT_COMPOST_EFFECTS_RECTIFIED_HPP +#define SPROUT_COMPOST_EFFECTS_RECTIFIED_HPP #include #include @@ -63,4 +63,4 @@ namespace sprout { } // namespace compost } // namespace sprout -#endif // #ifndef SPROUT_COMPOST_EFFECTS_RECTIFY_HPP +#endif // #ifndef SPROUT_COMPOST_EFFECTS_RECTIFIED_HPP diff --git a/sprout/compost/effects/reverb.hpp b/sprout/compost/effects/reverbed.hpp similarity index 93% rename from sprout/compost/effects/reverb.hpp rename to sprout/compost/effects/reverbed.hpp index 73c0bb9f..256137d5 100644 --- a/sprout/compost/effects/reverb.hpp +++ b/sprout/compost/effects/reverbed.hpp @@ -1,5 +1,5 @@ -#ifndef SPROUT_COMPOST_EFFECTS_REVERB_HPP -#define SPROUT_COMPOST_EFFECTS_REVERB_HPP +#ifndef SPROUT_COMPOST_EFFECTS_REVERBED_HPP +#define SPROUT_COMPOST_EFFECTS_REVERBED_HPP #include #include @@ -146,4 +146,4 @@ namespace sprout { } // namespace compost } // namespace sprout -#endif // #ifndef SPROUT_COMPOST_EFFECTS_REVERB_HPP +#endif // #ifndef SPROUT_COMPOST_EFFECTS_REVERBED_HPP diff --git a/sprout/compost/effects/synthesize.hpp b/sprout/compost/effects/synthesized.hpp similarity index 100% rename from sprout/compost/effects/synthesize.hpp rename to sprout/compost/effects/synthesized.hpp diff --git a/sprout/compost/waves.hpp b/sprout/compost/waves.hpp index d47e16ec..a423bf56 100644 --- a/sprout/compost/waves.hpp +++ b/sprout/compost/waves.hpp @@ -2,6 +2,7 @@ #define SPROUT_COMPOST_WAVES_HPP #include +#include #include #include #include diff --git a/sprout/compost/waves/blanked.hpp b/sprout/compost/waves/blanked.hpp new file mode 100644 index 00000000..730661bf --- /dev/null +++ b/sprout/compost/waves/blanked.hpp @@ -0,0 +1,41 @@ +#ifndef SPROUT_COMPOST_WAVES_BLANKED_HPP +#define SPROUT_COMPOST_WAVES_BLANKED_HPP + +#include +#include + +namespace sprout { + namespace compost { + namespace waves { + // + // blanked_forwarder + // + class blanked_forwarder { + public: + SPROUT_CONSTEXPR sprout::adaptors::blanked_range + operator()() const { + return sprout::adaptors::blanked_range(); + } + template + SPROUT_CONSTEXPR sprout::adaptors::blanked_range + operator()(Difference n) const { + return sprout::adaptors::blanked_range(n); + } + template + SPROUT_CONSTEXPR sprout::adaptors::blanked_range + operator()(Difference n, T const& value) const { + return sprout::adaptors::blanked_range(n, value); + } + }; + + // + // blanked + // + namespace { + SPROUT_STATIC_CONSTEXPR sprout::compost::waves::blanked_forwarder blanked{}; + } // anonymous-namespace + } // namespace waves + } // namespace compost +} // namespace sprout + +#endif // #ifndef SPROUT_COMPOST_WAVES_BLANKED_HPP diff --git a/sprout/iterator/joint_iterator.hpp b/sprout/iterator/joint_iterator.hpp index 802a5bd3..1fd636fb 100644 --- a/sprout/iterator/joint_iterator.hpp +++ b/sprout/iterator/joint_iterator.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT namespace sprout { @@ -254,7 +255,7 @@ namespace sprout { typename LIterator1, typename RIterator1, typename LIterator2, typename RIterator2 > - inline SPROUT_CONSTEXPR typename std::common_type< + inline SPROUT_CONSTEXPR typename sprout::arithmetic_promote< typename sprout::joint_iterator::difference_type, typename sprout::joint_iterator::difference_type >::type diff --git a/sprout/iterator/traits.hpp b/sprout/iterator/traits.hpp deleted file mode 100644 index ce473c08..00000000 --- a/sprout/iterator/traits.hpp +++ /dev/null @@ -1,248 +0,0 @@ -#ifndef SPROUT_ITERATOR_TRAITS_HPP -#define SPROUT_ITERATOR_TRAITS_HPP - -#include -#include -#include -#include - -namespace sprout { - namespace detail { - // has_iterator_category - SPROUT_HAS_XXX_TYPE_DEF_LAZY(iterator_category); - } // namespace detail - // - // is_iterator - // - template - struct is_iterator - : sprout::detail::has_iterator_category > - {}; - - // - // is_input_iterator_category - // - template - struct is_input_iterator_category - : public std::is_convertible - {}; - // - // is_output_iterator_category - // - template - struct is_output_iterator_category - : public std::is_convertible - {}; - // - // is_forward_iterator_category - // - template - struct is_forward_iterator_category - : public std::is_convertible - {}; - // - // is_bidirectional_iterator_category - // - template - struct is_bidirectional_iterator_category - : public std::is_convertible - {}; - // - // is_random_access_iterator_category - // - template - struct is_random_access_iterator_category - : public std::is_convertible - {}; - - // - // is_input_iterator - // - template - struct is_input_iterator - : public sprout::is_input_iterator_category::iterator_category> - {}; - // - // is_output_iterator - // - template - struct is_output_iterator - : public sprout::is_output_iterator_category::iterator_category> - {}; - // - // is_forward_iterator - // - template - struct is_forward_iterator - : public sprout::is_forward_iterator_category::iterator_category> - {}; - // - // is_bidirectional_iterator - // - template - struct is_bidirectional_iterator - : public sprout::is_bidirectional_iterator_category::iterator_category> - {}; - // - // is_random_access_iterator - // - template - struct is_random_access_iterator - : public sprout::is_random_access_iterator_category::iterator_category> - {}; - - namespace detail { - template - struct iterator_category_hierarchy_impl; - template - struct iterator_category_hierarchy_impl - : public std::integral_constant - {}; - template - struct iterator_category_hierarchy_impl - : public std::integral_constant - {}; - template - struct iterator_category_hierarchy_impl - : public std::integral_constant - {}; - template - struct iterator_category_hierarchy_impl - : public std::integral_constant - {}; - - template - struct iterator_category_hierarchy - : public sprout::detail::iterator_category_hierarchy_impl< - Category, - sprout::is_random_access_iterator_category::value, - sprout::is_bidirectional_iterator_category::value, - sprout::is_forward_iterator_category::value, - sprout::is_input_iterator_category::value || sprout::is_output_iterator_category::value - > - {}; - - template - struct iterator_category_less - : public std::integral_constant< - bool, - (sprout::detail::iterator_category_hierarchy::value < sprout::detail::iterator_category_hierarchy::value) - > - {}; - } // namespace detail - // - // min_iterator_category - // - template - struct min_iterator_category; - template - struct min_iterator_category - : public std::common_type - {}; - template - struct min_iterator_category - : public std::conditional< - sprout::detail::iterator_category_less::value, - Category1, Category2 - > - {}; - template - struct min_iterator_category - : public sprout::min_iterator_category< - Head, - typename sprout::min_iterator_category::type - > - {}; - - // - // common_iterator_category - // - template - struct common_iterator_category - : public sprout::min_iterator_category< - typename std::iterator_traits::iterator_category... - > - {}; - - namespace detail { - template - struct common_iterator_reference_impl; - template - struct common_iterator_reference_impl { - public: - typedef T type; - }; - template - struct common_iterator_reference_impl - : public std::conditional< - std::is_reference::value && std::is_reference::value, - typename std::conditional< - std::is_convertible::value - && (std::is_same::type, typename std::decay::type>::value - || std::is_base_of::type, typename std::decay::type>::value - ) - , - U, - typename std::conditional< - std::is_convertible::value - && (std::is_same::type, typename std::decay::type>::value - || std::is_base_of::type, typename std::decay::type>::value - ) - , - T, - typename std::common_type::type, typename std::decay::type>::type - >::type - >::type, - typename std::common_type::type, typename std::decay::type>::type - > - {}; - template - struct common_iterator_reference_impl - : public sprout::detail::common_iterator_reference_impl< - typename sprout::detail::common_iterator_reference_impl::type, - Tail... - > - {}; - } // namespace detail - // - // common_iterator_reference - // - template - struct common_iterator_reference - : public sprout::detail::common_iterator_reference_impl< - typename std::iterator_traits::reference... - > - {}; - - // - // common_iterator_value_type - // - template - struct common_iterator_value_type - : public std::decay< - typename sprout::common_iterator_reference::type - > - {}; - - // - // common_iterator_pointer - // - template - struct common_iterator_pointer - : public std::add_pointer< - typename std::remove_reference::type>::type - > - {}; - - // - // common_iterator_difference_type - // - template - struct common_iterator_difference_type - : public std::common_type< - typename std::iterator_traits::difference_type... - > - {}; -} // namespace sprout - -#endif // #ifndef SPROUT_ITERATOR_TRAITS_HPP diff --git a/sprout/iterator/type_traits/common.hpp b/sprout/iterator/type_traits/common.hpp index 177f51d6..b7e228b9 100644 --- a/sprout/iterator/type_traits/common.hpp +++ b/sprout/iterator/type_traits/common.hpp @@ -106,10 +106,10 @@ namespace sprout { ) , T, - typename std::common_type::type, typename std::decay::type>::type + typename std::decay::type, typename std::decay::type>::type>::type >::type >::type, - typename std::common_type::type, typename std::decay::type>::type + typename std::decay::type, typename std::decay::type>::type>::type > {}; template @@ -155,8 +155,8 @@ namespace sprout { // template struct common_iterator_difference_type - : public std::common_type< - typename std::iterator_traits::difference_type... + : public std::decay< + typename std::common_type::difference_type...>::type > {}; } // namespace sprout diff --git a/sprout/pit.hpp b/sprout/pit.hpp index 62f59d3b..71b7bc51 100644 --- a/sprout/pit.hpp +++ b/sprout/pit.hpp @@ -8,6 +8,5 @@ #include #include #include -#include #endif // #ifndef SPROUT_PIT_HPP diff --git a/sprout/pit/blank.hpp b/sprout/pit/blank.hpp deleted file mode 100644 index 18c8334c..00000000 --- a/sprout/pit/blank.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef SPROUT_PIT_BLANK_HPP -#define SPROUT_PIT_BLANK_HPP - -#include -#include -#include -#include - -namespace sprout { - // - // blank - // - struct blank {}; - - // - // blank_pit - // - template - inline SPROUT_CONSTEXPR sprout::pit > - blank_pit() { - return sprout::pit >(); - } -} // namespace sprout - -#endif // #ifndef SPROUT_PIT_BLANK_HPP diff --git a/sprout/pit/pit.hpp b/sprout/pit/pit.hpp index 15936a66..b7cdef0f 100644 --- a/sprout/pit/pit.hpp +++ b/sprout/pit/pit.hpp @@ -49,10 +49,10 @@ namespace sprout { return const_iterator(elem, static_size); } iterator end() SPROUT_NOEXCEPT { - return iterator(); + return iterator(elem, 0); } SPROUT_CONSTEXPR const_iterator end() const SPROUT_NOEXCEPT { - return const_iterator(); + return const_iterator(elem, 0); } reverse_iterator rbegin() SPROUT_NOEXCEPT { return reverse_iterator(end()); @@ -70,7 +70,7 @@ namespace sprout { return const_iterator(elem, static_size); } SPROUT_CONSTEXPR const_iterator cend() const SPROUT_NOEXCEPT { - return const_iterator(); + return const_iterator(elem, 0); } SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT { return const_reverse_iterator(end()); diff --git a/sprout/range/adaptor.hpp b/sprout/range/adaptor.hpp index 6e275f30..83bc982c 100644 --- a/sprout/range/adaptor.hpp +++ b/sprout/range/adaptor.hpp @@ -10,10 +10,11 @@ #include #include #include -#include -#include #include #include +#include +#include +#include #include #include #include diff --git a/sprout/range/adaptor/blanked.hpp b/sprout/range/adaptor/blanked.hpp new file mode 100644 index 00000000..81acdcfb --- /dev/null +++ b/sprout/range/adaptor/blanked.hpp @@ -0,0 +1,189 @@ +#ifndef SPROUT_RANGE_ADAPTOR_BLANKED_HPP +#define SPROUT_RANGE_ADAPTOR_BLANKED_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT + +namespace sprout { + // + // blank_t + // + struct blank_t {}; + + namespace adaptors { + // + // blanked_range + // + template + class blanked_range + : public sprout::range::range_container< + sprout::value_iterator + > + , public sprout::detail::container_nosy_static_size + , public sprout::detail::container_nosy_fixed_size + { + public: + typedef Range range_type; + typedef sprout::range::range_container< + sprout::value_iterator + > base_type; + typedef typename base_type::iterator iterator; + typedef typename base_type::value_type value_type; + typedef typename base_type::difference_type difference_type; + typedef typename base_type::size_type size_type; + public: + blanked_range() = default; + blanked_range(blanked_range const&) = default; + explicit SPROUT_CONSTEXPR blanked_range(range_type& range) + : base_type( + iterator(value_type(), sprout::size(range)), + iterator(value_type(), 0) + ) + {} + SPROUT_CONSTEXPR blanked_range( + range_type& range, + difference_type n + ) + : base_type( + iterator(value_type(), static_cast(NS_SSCRISK_CEL_OR_SPROUT::min(n, sprout::size(range)))), + iterator(value_type(), 0) + ) + {} + SPROUT_CONSTEXPR blanked_range( + range_type& range, + difference_type n, + value_type const& value + ) + : base_type( + iterator(value, static_cast(NS_SSCRISK_CEL_OR_SPROUT::min(n, sprout::size(range)))), + iterator(value, 0) + ) + {} + }; + + template + class blanked_range + : public sprout::range::range_container< + sprout::value_iterator + > + { + public: + typedef sprout::range::range_container< + sprout::value_iterator + > base_type; + typedef typename base_type::iterator iterator; + typedef typename base_type::value_type value_type; + typedef typename base_type::difference_type difference_type; + public: + SPROUT_CONSTEXPR blanked_range() + : base_type( + iterator(value_type()), + iterator(value_type(), 0) + ) + {} + blanked_range(blanked_range const&) = default; + explicit SPROUT_CONSTEXPR blanked_range(difference_type n) + : base_type( + iterator(value_type(), n), + iterator(value_type(), 0) + ) + {} + SPROUT_CONSTEXPR blanked_range( + difference_type n, + value_type const& value + ) + : base_type( + iterator(value, n), + iterator(value, 0) + ) + {} + }; + + // + // blanked_forwarder + // + class blanked_forwarder { + public: + SPROUT_CONSTEXPR sprout::adaptors::blanked_range<> + operator()() const { + return sprout::adaptors::blanked_range<>(); + } + template + SPROUT_CONSTEXPR sprout::adaptors::blanked_range<> + operator()(Difference n) const { + return sprout::adaptors::blanked_range<>(n); + } + template + SPROUT_CONSTEXPR sprout::adaptors::blanked_range + operator()(Difference n, T const& value) const { + return sprout::adaptors::blanked_range(n, value); + } + }; + + // + // blanked + // + namespace { + SPROUT_STATIC_CONSTEXPR sprout::adaptors::blanked_forwarder blanked{}; + } // anonymous-namespace + + // + // operator| + // + template + inline SPROUT_CONSTEXPR sprout::adaptors::blanked_range< + T, + typename std::remove_reference::type>::type + > + operator|(Range&& lhs, sprout::adaptors::blanked_range const& rhs) { + return sprout::adaptors::blanked_range< + T, + typename std::remove_reference::type>::type + >( + sprout::lvalue_forward(lhs), + sprout::size(rhs), + !sprout::empty(rhs) ? *rhs.begin() + : typename sprout::container_traits >::value_type() + ); + } + } // namespace adaptors + + // + // container_construct_traits + // + template + struct container_construct_traits > { + public: + typedef typename sprout::container_construct_traits::copied_type copied_type; + public: + template + static SPROUT_CONSTEXPR copied_type deep_copy(Cont&& cont) { + return sprout::range::fixed::copy(sprout::forward(cont), sprout::pit()); + } + template + static SPROUT_CONSTEXPR copied_type make(Args&&... args) { + return sprout::make(sprout::forward(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), size, sprout::forward(args)...); + } + }; +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_ADAPTOR_BLANKED_HPP diff --git a/sprout/range/adaptor/sawtooth_wave.hpp b/sprout/range/adaptor/sawtooth_wave.hpp index 2836559c..03a47ac9 100644 --- a/sprout/range/adaptor/sawtooth_wave.hpp +++ b/sprout/range/adaptor/sawtooth_wave.hpp @@ -48,13 +48,13 @@ namespace sprout { iterator(sprout::size(range), frequency, amplitude, phase) ) {} - SPROUT_CONSTEXPR value_type const& frequency() const { + SPROUT_CONSTEXPR value_type frequency() const { return base_type::begin().frequency(); } - SPROUT_CONSTEXPR value_type const& amplitude() const { + SPROUT_CONSTEXPR value_type amplitude() const { return base_type::begin().amplitude(); } - SPROUT_CONSTEXPR value_type const& phase() const { + SPROUT_CONSTEXPR value_type phase() const { return base_type::begin().phase(); } }; diff --git a/sprout/range/adaptor/sinusoidal.hpp b/sprout/range/adaptor/sinusoidal.hpp index 99feec88..aa7a01c0 100644 --- a/sprout/range/adaptor/sinusoidal.hpp +++ b/sprout/range/adaptor/sinusoidal.hpp @@ -48,13 +48,13 @@ namespace sprout { iterator(sprout::size(range), frequency, amplitude, phase) ) {} - SPROUT_CONSTEXPR value_type const& frequency() const { + SPROUT_CONSTEXPR value_type frequency() const { return base_type::begin().frequency(); } - SPROUT_CONSTEXPR value_type const& amplitude() const { + SPROUT_CONSTEXPR value_type amplitude() const { return base_type::begin().amplitude(); } - SPROUT_CONSTEXPR value_type const& phase() const { + SPROUT_CONSTEXPR value_type phase() const { return base_type::begin().phase(); } }; @@ -85,13 +85,13 @@ namespace sprout { iterator(-1, frequency, amplitude, phase) ) {} - SPROUT_CONSTEXPR value_type const& frequency() const { + SPROUT_CONSTEXPR value_type frequency() const { return base_type::begin().frequency(); } - SPROUT_CONSTEXPR value_type const& amplitude() const { + SPROUT_CONSTEXPR value_type amplitude() const { return base_type::begin().amplitude(); } - SPROUT_CONSTEXPR value_type const& phase() const { + SPROUT_CONSTEXPR value_type phase() const { return base_type::begin().phase(); } }; diff --git a/sprout/range/adaptor/square_wave.hpp b/sprout/range/adaptor/square_wave.hpp index 55a26da4..e0b6b540 100644 --- a/sprout/range/adaptor/square_wave.hpp +++ b/sprout/range/adaptor/square_wave.hpp @@ -49,16 +49,16 @@ namespace sprout { iterator(sprout::size(range), frequency, amplitude, phase, duty) ) {} - SPROUT_CONSTEXPR value_type const& frequency() const { + SPROUT_CONSTEXPR value_type frequency() const { return base_type::begin().frequency(); } - SPROUT_CONSTEXPR value_type const& amplitude() const { + SPROUT_CONSTEXPR value_type amplitude() const { return base_type::begin().amplitude(); } - SPROUT_CONSTEXPR value_type const& phase() const { + SPROUT_CONSTEXPR value_type phase() const { return base_type::begin().phase(); } - SPROUT_CONSTEXPR value_type const& duty() const { + SPROUT_CONSTEXPR value_type duty() const { return base_type::begin().duty(); } }; @@ -90,16 +90,16 @@ namespace sprout { iterator(-1, frequency, amplitude, phase, duty) ) {} - SPROUT_CONSTEXPR value_type const& frequency() const { + SPROUT_CONSTEXPR value_type frequency() const { return base_type::begin().frequency(); } - SPROUT_CONSTEXPR value_type const& amplitude() const { + SPROUT_CONSTEXPR value_type amplitude() const { return base_type::begin().amplitude(); } - SPROUT_CONSTEXPR value_type const& phase() const { + SPROUT_CONSTEXPR value_type phase() const { return base_type::begin().phase(); } - SPROUT_CONSTEXPR value_type const& duty() const { + SPROUT_CONSTEXPR value_type duty() const { return base_type::begin().duty(); } }; diff --git a/sprout/range/adaptor/triangle_wave.hpp b/sprout/range/adaptor/triangle_wave.hpp index ea9723ae..6c52cd7e 100644 --- a/sprout/range/adaptor/triangle_wave.hpp +++ b/sprout/range/adaptor/triangle_wave.hpp @@ -48,13 +48,13 @@ namespace sprout { iterator(sprout::size(range), frequency, amplitude, phase) ) {} - SPROUT_CONSTEXPR value_type const& frequency() const { + SPROUT_CONSTEXPR value_type frequency() const { return base_type::begin().frequency(); } - SPROUT_CONSTEXPR value_type const& amplitude() const { + SPROUT_CONSTEXPR value_type amplitude() const { return base_type::begin().amplitude(); } - SPROUT_CONSTEXPR value_type const& phase() const { + SPROUT_CONSTEXPR value_type phase() const { return base_type::begin().phase(); } }; @@ -85,13 +85,13 @@ namespace sprout { iterator(-1, frequency, amplitude, phase) ) {} - SPROUT_CONSTEXPR value_type const& frequency() const { + SPROUT_CONSTEXPR value_type frequency() const { return base_type::begin().frequency(); } - SPROUT_CONSTEXPR value_type const& amplitude() const { + SPROUT_CONSTEXPR value_type amplitude() const { return base_type::begin().amplitude(); } - SPROUT_CONSTEXPR value_type const& phase() const { + SPROUT_CONSTEXPR value_type phase() const { return base_type::begin().phase(); } };