mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
add adaptors::blanked
This commit is contained in:
parent
e286c9bc6b
commit
ded2da84ea
27 changed files with 350 additions and 349 deletions
|
@ -2,18 +2,20 @@
|
|||
#define SPROUT_COMPOST_EFFECTS_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/compost/effects/clip.hpp>
|
||||
#include <sprout/compost/effects/rectify.hpp>
|
||||
#include <sprout/compost/effects/change_volume.hpp>
|
||||
#include <sprout/compost/effects/reverb.hpp>
|
||||
#include <sprout/compost/effects/distort.hpp>
|
||||
#include <sprout/compost/effects/overdrive.hpp>
|
||||
#include <sprout/compost/effects/fuzz.hpp>
|
||||
#include <sprout/compost/effects/compress.hpp>
|
||||
#include <sprout/compost/effects/clipped.hpp>
|
||||
#include <sprout/compost/effects/rectified.hpp>
|
||||
#include <sprout/compost/effects/changed_volume.hpp>
|
||||
#include <sprout/compost/effects/reverbed.hpp>
|
||||
#include <sprout/compost/effects/distorted.hpp>
|
||||
#include <sprout/compost/effects/overdrived.hpp>
|
||||
#include <sprout/compost/effects/fuzzed.hpp>
|
||||
#include <sprout/compost/effects/compressed.hpp>
|
||||
#include <sprout/compost/effects/tremolo.hpp>
|
||||
#include <sprout/compost/effects/vibrato.hpp>
|
||||
#include <sprout/compost/effects/chorus.hpp>
|
||||
#include <sprout/compost/effects/noise_gate.hpp>
|
||||
#include <sprout/compost/effects/synthesize.hpp>
|
||||
#include <sprout/compost/effects/noise_gated.hpp>
|
||||
#include <sprout/compost/effects/synthesized.hpp>
|
||||
#include <sprout/compost/effects/jointed.hpp>
|
||||
#include <sprout/compost/effects/copied.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_COMPOST_EFFECTS_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 <sprout/config.hpp>
|
||||
#include <sprout/functional/multiplies.hpp>
|
||||
|
@ -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
|
|
@ -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 <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
|
@ -82,4 +82,4 @@ namespace sprout {
|
|||
} // namespace compost
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_COMPOST_EFFECTS_CLIP_HPP
|
||||
#endif // #ifndef SPROUT_COMPOST_EFFECTS_CLIPPED_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 <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
|
@ -123,4 +123,4 @@ namespace sprout {
|
|||
} // namespace compost
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_COMPOST_EFFECTS_COMPRESS_HPP
|
||||
#endif // #ifndef SPROUT_COMPOST_EFFECTS_COMPRESEDS_HPP
|
20
sprout/compost/effects/copied.hpp
Normal file
20
sprout/compost/effects/copied.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef SPROUT_COMPOST_EFFECTS_COPIED_HPP
|
||||
#define SPROUT_COMPOST_EFFECTS_COPIED_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/adaptor/copied.hpp>
|
||||
|
||||
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
|
|
@ -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 <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/compost/effects/clip.hpp>
|
||||
#include <sprout/compost/effects/change_volume.hpp>
|
||||
#include <sprout/compost/effects/clipped.hpp>
|
||||
#include <sprout/compost/effects/changed_volume.hpp>
|
||||
|
||||
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
|
|
@ -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 <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/range/adaptor/transformed.hpp>
|
||||
#include <sprout/compost/effects/rectify.hpp>
|
||||
#include <sprout/compost/effects/distort.hpp>
|
||||
#include <sprout/compost/effects/rectified.hpp>
|
||||
#include <sprout/compost/effects/distorted.hpp>
|
||||
|
||||
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
|
20
sprout/compost/effects/jointed.hpp
Normal file
20
sprout/compost/effects/jointed.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef SPROUT_COMPOST_EFFECTS_JOINTED_HPP
|
||||
#define SPROUT_COMPOST_EFFECTS_JOINTED_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/adaptor/jointed.hpp>
|
||||
|
||||
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
|
|
@ -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 <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
|
@ -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
|
|
@ -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 <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/math/constants.hpp>
|
||||
#include <sprout/math/atan.hpp>
|
||||
#include <sprout/range/adaptor/transformed.hpp>
|
||||
#include <sprout/compost/effects/change_volume.hpp>
|
||||
#include <sprout/compost/effects/changed_volume.hpp>
|
||||
|
||||
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
|
|
@ -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 <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
|
@ -63,4 +63,4 @@ namespace sprout {
|
|||
} // namespace compost
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_COMPOST_EFFECTS_RECTIFY_HPP
|
||||
#endif // #ifndef SPROUT_COMPOST_EFFECTS_RECTIFIED_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 <cstddef>
|
||||
#include <iterator>
|
||||
|
@ -146,4 +146,4 @@ namespace sprout {
|
|||
} // namespace compost
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_COMPOST_EFFECTS_REVERB_HPP
|
||||
#endif // #ifndef SPROUT_COMPOST_EFFECTS_REVERBED_HPP
|
|
@ -2,6 +2,7 @@
|
|||
#define SPROUT_COMPOST_WAVES_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/compost/waves/blanked.hpp>
|
||||
#include <sprout/compost/waves/sinusoidal.hpp>
|
||||
#include <sprout/compost/waves/sawtooth_wave.hpp>
|
||||
#include <sprout/compost/waves/triangle_wave.hpp>
|
||||
|
|
41
sprout/compost/waves/blanked.hpp
Normal file
41
sprout/compost/waves/blanked.hpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#ifndef SPROUT_COMPOST_WAVES_BLANKED_HPP
|
||||
#define SPROUT_COMPOST_WAVES_BLANKED_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/adaptor/blanked.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace compost {
|
||||
namespace waves {
|
||||
//
|
||||
// blanked_forwarder
|
||||
//
|
||||
class blanked_forwarder {
|
||||
public:
|
||||
SPROUT_CONSTEXPR sprout::adaptors::blanked_range<double>
|
||||
operator()() const {
|
||||
return sprout::adaptors::blanked_range<double>();
|
||||
}
|
||||
template<typename Difference>
|
||||
SPROUT_CONSTEXPR sprout::adaptors::blanked_range<double>
|
||||
operator()(Difference n) const {
|
||||
return sprout::adaptors::blanked_range<double>(n);
|
||||
}
|
||||
template<typename T, typename Difference>
|
||||
SPROUT_CONSTEXPR sprout::adaptors::blanked_range<T>
|
||||
operator()(Difference n, T const& value) const {
|
||||
return sprout::adaptors::blanked_range<T>(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
|
|
@ -10,6 +10,7 @@
|
|||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/iterator/type_traits/common.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/type_traits/arithmetic_promote.hpp>
|
||||
#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<LIterator1, RIterator1>::difference_type,
|
||||
typename sprout::joint_iterator<LIterator2, RIterator2>::difference_type
|
||||
>::type
|
||||
|
|
|
@ -1,248 +0,0 @@
|
|||
#ifndef SPROUT_ITERATOR_TRAITS_HPP
|
||||
#define SPROUT_ITERATOR_TRAITS_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/type_traits/has_xxx.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace detail {
|
||||
// has_iterator_category
|
||||
SPROUT_HAS_XXX_TYPE_DEF_LAZY(iterator_category);
|
||||
} // namespace detail
|
||||
//
|
||||
// is_iterator
|
||||
//
|
||||
template<typename Iterator>
|
||||
struct is_iterator
|
||||
: sprout::detail::has_iterator_category<std::iterator_traits<Iterator> >
|
||||
{};
|
||||
|
||||
//
|
||||
// is_input_iterator_category
|
||||
//
|
||||
template<typename Category>
|
||||
struct is_input_iterator_category
|
||||
: public std::is_convertible<Category, std::input_iterator_tag>
|
||||
{};
|
||||
//
|
||||
// is_output_iterator_category
|
||||
//
|
||||
template<typename Category>
|
||||
struct is_output_iterator_category
|
||||
: public std::is_convertible<Category, std::output_iterator_tag>
|
||||
{};
|
||||
//
|
||||
// is_forward_iterator_category
|
||||
//
|
||||
template<typename Category>
|
||||
struct is_forward_iterator_category
|
||||
: public std::is_convertible<Category, std::forward_iterator_tag>
|
||||
{};
|
||||
//
|
||||
// is_bidirectional_iterator_category
|
||||
//
|
||||
template<typename Category>
|
||||
struct is_bidirectional_iterator_category
|
||||
: public std::is_convertible<Category, std::bidirectional_iterator_tag>
|
||||
{};
|
||||
//
|
||||
// is_random_access_iterator_category
|
||||
//
|
||||
template<typename Category>
|
||||
struct is_random_access_iterator_category
|
||||
: public std::is_convertible<Category, std::random_access_iterator_tag>
|
||||
{};
|
||||
|
||||
//
|
||||
// is_input_iterator
|
||||
//
|
||||
template<typename Iterator>
|
||||
struct is_input_iterator
|
||||
: public sprout::is_input_iterator_category<typename std::iterator_traits<Iterator>::iterator_category>
|
||||
{};
|
||||
//
|
||||
// is_output_iterator
|
||||
//
|
||||
template<typename Iterator>
|
||||
struct is_output_iterator
|
||||
: public sprout::is_output_iterator_category<typename std::iterator_traits<Iterator>::iterator_category>
|
||||
{};
|
||||
//
|
||||
// is_forward_iterator
|
||||
//
|
||||
template<typename Iterator>
|
||||
struct is_forward_iterator
|
||||
: public sprout::is_forward_iterator_category<typename std::iterator_traits<Iterator>::iterator_category>
|
||||
{};
|
||||
//
|
||||
// is_bidirectional_iterator
|
||||
//
|
||||
template<typename Iterator>
|
||||
struct is_bidirectional_iterator
|
||||
: public sprout::is_bidirectional_iterator_category<typename std::iterator_traits<Iterator>::iterator_category>
|
||||
{};
|
||||
//
|
||||
// is_random_access_iterator
|
||||
//
|
||||
template<typename Iterator>
|
||||
struct is_random_access_iterator
|
||||
: public sprout::is_random_access_iterator_category<typename std::iterator_traits<Iterator>::iterator_category>
|
||||
{};
|
||||
|
||||
namespace detail {
|
||||
template<typename Category, bool IsRandomAccess, bool IsBidirectional, bool IsForward, bool IsSinglePassOrIncrementable>
|
||||
struct iterator_category_hierarchy_impl;
|
||||
template<typename Category, bool IsBidirectional, bool IsForward, bool IsSinglePassOrIncrementable>
|
||||
struct iterator_category_hierarchy_impl<Category, true, IsBidirectional, IsForward, IsSinglePassOrIncrementable>
|
||||
: public std::integral_constant<int, 4>
|
||||
{};
|
||||
template<typename Category, bool IsForward, bool IsSinglePassOrIncrementable>
|
||||
struct iterator_category_hierarchy_impl<Category, false, true, IsForward, IsSinglePassOrIncrementable>
|
||||
: public std::integral_constant<int, 3>
|
||||
{};
|
||||
template<typename Category, bool IsSinglePassOrIncrementable>
|
||||
struct iterator_category_hierarchy_impl<Category, false, false, true, IsSinglePassOrIncrementable>
|
||||
: public std::integral_constant<int, 2>
|
||||
{};
|
||||
template<typename Category>
|
||||
struct iterator_category_hierarchy_impl<Category, false, false, false, true>
|
||||
: public std::integral_constant<int, 1>
|
||||
{};
|
||||
|
||||
template<typename Category>
|
||||
struct iterator_category_hierarchy
|
||||
: public sprout::detail::iterator_category_hierarchy_impl<
|
||||
Category,
|
||||
sprout::is_random_access_iterator_category<Category>::value,
|
||||
sprout::is_bidirectional_iterator_category<Category>::value,
|
||||
sprout::is_forward_iterator_category<Category>::value,
|
||||
sprout::is_input_iterator_category<Category>::value || sprout::is_output_iterator_category<Category>::value
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename Category1, typename Category2>
|
||||
struct iterator_category_less
|
||||
: public std::integral_constant<
|
||||
bool,
|
||||
(sprout::detail::iterator_category_hierarchy<Category1>::value < sprout::detail::iterator_category_hierarchy<Category2>::value)
|
||||
>
|
||||
{};
|
||||
} // namespace detail
|
||||
//
|
||||
// min_iterator_category
|
||||
//
|
||||
template<typename Head, typename... Tail>
|
||||
struct min_iterator_category;
|
||||
template<typename Category>
|
||||
struct min_iterator_category<Category>
|
||||
: public std::common_type<Category>
|
||||
{};
|
||||
template<typename Category1, typename Category2>
|
||||
struct min_iterator_category<Category1, Category2>
|
||||
: public std::conditional<
|
||||
sprout::detail::iterator_category_less<Category1, Category2>::value,
|
||||
Category1, Category2
|
||||
>
|
||||
{};
|
||||
template<typename Head, typename... Tail>
|
||||
struct min_iterator_category
|
||||
: public sprout::min_iterator_category<
|
||||
Head,
|
||||
typename sprout::min_iterator_category<Tail...>::type
|
||||
>
|
||||
{};
|
||||
|
||||
//
|
||||
// common_iterator_category
|
||||
//
|
||||
template<typename... Iterators>
|
||||
struct common_iterator_category
|
||||
: public sprout::min_iterator_category<
|
||||
typename std::iterator_traits<Iterators>::iterator_category...
|
||||
>
|
||||
{};
|
||||
|
||||
namespace detail {
|
||||
template<typename... Types>
|
||||
struct common_iterator_reference_impl;
|
||||
template<typename T>
|
||||
struct common_iterator_reference_impl<T> {
|
||||
public:
|
||||
typedef T type;
|
||||
};
|
||||
template<typename T, typename U>
|
||||
struct common_iterator_reference_impl<T, U>
|
||||
: public std::conditional<
|
||||
std::is_reference<T>::value && std::is_reference<U>::value,
|
||||
typename std::conditional<
|
||||
std::is_convertible<T, U>::value
|
||||
&& (std::is_same<typename std::decay<T>::type, typename std::decay<U>::type>::value
|
||||
|| std::is_base_of<typename std::decay<U>::type, typename std::decay<T>::type>::value
|
||||
)
|
||||
,
|
||||
U,
|
||||
typename std::conditional<
|
||||
std::is_convertible<U, T>::value
|
||||
&& (std::is_same<typename std::decay<U>::type, typename std::decay<T>::type>::value
|
||||
|| std::is_base_of<typename std::decay<T>::type, typename std::decay<U>::type>::value
|
||||
)
|
||||
,
|
||||
T,
|
||||
typename std::common_type<typename std::decay<T>::type, typename std::decay<U>::type>::type
|
||||
>::type
|
||||
>::type,
|
||||
typename std::common_type<typename std::decay<T>::type, typename std::decay<U>::type>::type
|
||||
>
|
||||
{};
|
||||
template<typename T, typename U, typename... Tail>
|
||||
struct common_iterator_reference_impl<T, U, Tail...>
|
||||
: public sprout::detail::common_iterator_reference_impl<
|
||||
typename sprout::detail::common_iterator_reference_impl<T, U>::type,
|
||||
Tail...
|
||||
>
|
||||
{};
|
||||
} // namespace detail
|
||||
//
|
||||
// common_iterator_reference
|
||||
//
|
||||
template<typename... Iterators>
|
||||
struct common_iterator_reference
|
||||
: public sprout::detail::common_iterator_reference_impl<
|
||||
typename std::iterator_traits<Iterators>::reference...
|
||||
>
|
||||
{};
|
||||
|
||||
//
|
||||
// common_iterator_value_type
|
||||
//
|
||||
template<typename... Iterators>
|
||||
struct common_iterator_value_type
|
||||
: public std::decay<
|
||||
typename sprout::common_iterator_reference<Iterators...>::type
|
||||
>
|
||||
{};
|
||||
|
||||
//
|
||||
// common_iterator_pointer
|
||||
//
|
||||
template<typename... Iterators>
|
||||
struct common_iterator_pointer
|
||||
: public std::add_pointer<
|
||||
typename std::remove_reference<typename sprout::common_iterator_reference<Iterators...>::type>::type
|
||||
>
|
||||
{};
|
||||
|
||||
//
|
||||
// common_iterator_difference_type
|
||||
//
|
||||
template<typename... Iterators>
|
||||
struct common_iterator_difference_type
|
||||
: public std::common_type<
|
||||
typename std::iterator_traits<Iterators>::difference_type...
|
||||
>
|
||||
{};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ITERATOR_TRAITS_HPP
|
|
@ -106,10 +106,10 @@ namespace sprout {
|
|||
)
|
||||
,
|
||||
T,
|
||||
typename std::common_type<typename std::decay<T>::type, typename std::decay<U>::type>::type
|
||||
typename std::decay<typename std::common_type<typename std::decay<T>::type, typename std::decay<U>::type>::type>::type
|
||||
>::type
|
||||
>::type,
|
||||
typename std::common_type<typename std::decay<T>::type, typename std::decay<U>::type>::type
|
||||
typename std::decay<typename std::common_type<typename std::decay<T>::type, typename std::decay<U>::type>::type>::type
|
||||
>
|
||||
{};
|
||||
template<typename T, typename U, typename... Tail>
|
||||
|
@ -155,8 +155,8 @@ namespace sprout {
|
|||
//
|
||||
template<typename... Iterators>
|
||||
struct common_iterator_difference_type
|
||||
: public std::common_type<
|
||||
typename std::iterator_traits<Iterators>::difference_type...
|
||||
: public std::decay<
|
||||
typename std::common_type<typename std::iterator_traits<Iterators>::difference_type...>::type
|
||||
>
|
||||
{};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -8,6 +8,5 @@
|
|||
#include <sprout/pit/tuple.hpp>
|
||||
#include <sprout/pit/container.hpp>
|
||||
#include <sprout/pit/type_traits.hpp>
|
||||
#include <sprout/pit/blank.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_PIT_HPP
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef SPROUT_PIT_BLANK_HPP
|
||||
#define SPROUT_PIT_BLANK_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/pit/pit.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// blank
|
||||
//
|
||||
struct blank {};
|
||||
|
||||
//
|
||||
// blank_pit
|
||||
//
|
||||
template<std::size_t N>
|
||||
inline SPROUT_CONSTEXPR sprout::pit<sprout::array<sprout::blank, N> >
|
||||
blank_pit() {
|
||||
return sprout::pit<sprout::array<sprout::blank, N> >();
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_PIT_BLANK_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());
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
#include <sprout/range/adaptor/filtered.hpp>
|
||||
#include <sprout/range/adaptor/counting.hpp>
|
||||
#include <sprout/range/adaptor/outdirected.hpp>
|
||||
#include <sprout/range/adaptor/indexed.hpp>
|
||||
#include <sprout/range/adaptor/valued.hpp>
|
||||
#include <sprout/range/adaptor/jointed.hpp>
|
||||
#include <sprout/range/adaptor/deep_copied.hpp>
|
||||
#include <sprout/range/adaptor/indexed.hpp>
|
||||
#include <sprout/range/adaptor/valued.hpp>
|
||||
#include <sprout/range/adaptor/blanked.hpp>
|
||||
#include <sprout/range/adaptor/sized.hpp>
|
||||
#include <sprout/range/adaptor/size_enumed.hpp>
|
||||
#include <sprout/range/adaptor/wave.hpp>
|
||||
|
|
189
sprout/range/adaptor/blanked.hpp
Normal file
189
sprout/range/adaptor/blanked.hpp
Normal file
|
@ -0,0 +1,189 @@
|
|||
#ifndef SPROUT_RANGE_ADAPTOR_BLANKED_HPP
|
||||
#define SPROUT_RANGE_ADAPTOR_BLANKED_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/value_iterator.hpp>
|
||||
#include <sprout/range/range_container.hpp>
|
||||
#include <sprout/range/algorithm/copy.hpp>
|
||||
#include <sprout/type_traits/lvalue_reference.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/utility/lvalue_forward.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// blank_t
|
||||
//
|
||||
struct blank_t {};
|
||||
|
||||
namespace adaptors {
|
||||
//
|
||||
// blanked_range
|
||||
//
|
||||
template<typename T = sprout::blank_t, typename Range = void>
|
||||
class blanked_range
|
||||
: public sprout::range::range_container<
|
||||
sprout::value_iterator<T>
|
||||
>
|
||||
, public sprout::detail::container_nosy_static_size<Range>
|
||||
, public sprout::detail::container_nosy_fixed_size<Range>
|
||||
{
|
||||
public:
|
||||
typedef Range range_type;
|
||||
typedef sprout::range::range_container<
|
||||
sprout::value_iterator<T>
|
||||
> 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<difference_type>(NS_SSCRISK_CEL_OR_SPROUT::min<size_type>(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<difference_type>(NS_SSCRISK_CEL_OR_SPROUT::min<size_type>(n, sprout::size(range)))),
|
||||
iterator(value, 0)
|
||||
)
|
||||
{}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class blanked_range<T, void>
|
||||
: public sprout::range::range_container<
|
||||
sprout::value_iterator<T>
|
||||
>
|
||||
{
|
||||
public:
|
||||
typedef sprout::range::range_container<
|
||||
sprout::value_iterator<T>
|
||||
> 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<typename Difference>
|
||||
SPROUT_CONSTEXPR sprout::adaptors::blanked_range<>
|
||||
operator()(Difference n) const {
|
||||
return sprout::adaptors::blanked_range<>(n);
|
||||
}
|
||||
template<typename T, typename Difference>
|
||||
SPROUT_CONSTEXPR sprout::adaptors::blanked_range<T>
|
||||
operator()(Difference n, T const& value) const {
|
||||
return sprout::adaptors::blanked_range<T>(n, value);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// blanked
|
||||
//
|
||||
namespace {
|
||||
SPROUT_STATIC_CONSTEXPR sprout::adaptors::blanked_forwarder blanked{};
|
||||
} // anonymous-namespace
|
||||
|
||||
//
|
||||
// operator|
|
||||
//
|
||||
template<typename Range, typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::adaptors::blanked_range<
|
||||
T,
|
||||
typename std::remove_reference<typename sprout::lvalue_reference<Range>::type>::type
|
||||
>
|
||||
operator|(Range&& lhs, sprout::adaptors::blanked_range<T> const& rhs) {
|
||||
return sprout::adaptors::blanked_range<
|
||||
T,
|
||||
typename std::remove_reference<typename sprout::lvalue_reference<Range>::type>::type
|
||||
>(
|
||||
sprout::lvalue_forward<Range>(lhs),
|
||||
sprout::size(rhs),
|
||||
!sprout::empty(rhs) ? *rhs.begin()
|
||||
: typename sprout::container_traits<sprout::adaptors::blanked_range<T> >::value_type()
|
||||
);
|
||||
}
|
||||
} // namespace adaptors
|
||||
|
||||
//
|
||||
// container_construct_traits
|
||||
//
|
||||
template<typename T, typename Range>
|
||||
struct container_construct_traits<sprout::adaptors::blanked_range<T, Range> > {
|
||||
public:
|
||||
typedef typename sprout::container_construct_traits<Range>::copied_type copied_type;
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR copied_type deep_copy(Cont&& cont) {
|
||||
return sprout::range::fixed::copy(sprout::forward<Cont>(cont), sprout::pit<copied_type>());
|
||||
}
|
||||
template<typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type make(Args&&... args) {
|
||||
return sprout::make<copied_type>(sprout::forward<Args>(args)...);
|
||||
}
|
||||
template<typename Cont, typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type remake(
|
||||
Cont&& cont,
|
||||
typename sprout::container_traits<sprout::adaptors::blanked_range<T, Range> >::difference_type size,
|
||||
Args&&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake<copied_type>(sprout::forward<Cont>(cont), size, sprout::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ADAPTOR_BLANKED_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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue