mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-11-14 10:39:05 +00:00
add make_ptr_range
This commit is contained in:
parent
86cfc72bd6
commit
26dd9dabca
10 changed files with 72 additions and 12 deletions
8
sprout/range.hpp
Normal file
8
sprout/range.hpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef SPROUT_RANGE_HPP
|
||||
#define SPROUT_RANGE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/range.hpp>
|
||||
#include <sprout/range/type_traits.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_HPP
|
|
@ -4,7 +4,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/range/lvalue_range.hpp>
|
||||
#include <sprout/range/type_traits/lvalue_range.hpp>
|
||||
#include <sprout/algorithm/equal_range.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/utility/pair.hpp>
|
||||
#include <sprout/range/lvalue_iterator.hpp>
|
||||
#include <sprout/range/type_traits/lvalue_iterator.hpp>
|
||||
#include <sprout/algorithm/mismatch.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
|
35
sprout/range/ptr_range.hpp
Normal file
35
sprout/range/ptr_range.hpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef SPROUT_RANGE_PTR_RANGE_HPP
|
||||
#define SPROUT_RANGE_PTR_RANGE_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/ptr_index_iterator.hpp>
|
||||
#include <sprout/range/range_container.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// make_ptr_range
|
||||
//
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::range::range_container<sprout::ptr_index_iterator<T> >
|
||||
make_ptr_range(T* p, typename std::iterator_traits<T*>::difference_type n) {
|
||||
return sprout::range::range_container<sprout::ptr_index_iterator<T> >(
|
||||
sprout::ptr_index_iterator<T>(p),
|
||||
sprout::ptr_index_iterator<T>(p, n)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
inline SPROUT_CONSTEXPR sprout::range::range_container<sprout::ptr_index_iterator<T> >
|
||||
make_ptr_range(T (& arr)[N]) {
|
||||
return sprout::range::range_container<sprout::ptr_index_iterator<T> >(
|
||||
sprout::ptr_index_iterator<T>(arr),
|
||||
sprout::ptr_index_iterator<T>(arr, N)
|
||||
);
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_PTR_RANGE_HPP
|
9
sprout/range/range.hpp
Normal file
9
sprout/range/range.hpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef SPROUT_RANGE_RANGE_HPP
|
||||
#define SPROUT_RANGE_RANGE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/range_container.hpp>
|
||||
#include <sprout/range/ptr_range.hpp>
|
||||
#include <sprout/range/range_return.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_RANGE_HPP
|
|
@ -6,7 +6,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/range/lvalue_iterator.hpp>
|
||||
#include <sprout/range/type_traits/lvalue_iterator.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/range/lvalue_iterator.hpp>
|
||||
#include <sprout/range/lvalue_range.hpp>
|
||||
#include <sprout/range/type_traits/lvalue_iterator.hpp>
|
||||
#include <sprout/range/type_traits/lvalue_range.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
|
|
8
sprout/range/type_traits.hpp
Normal file
8
sprout/range/type_traits.hpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef SPROUT_RANGE_TYPE_TRAITS_HPP
|
||||
#define SPROUT_RANGE_TYPE_TRAITS_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/type_traits/lvalue_iterator.hpp>
|
||||
#include <sprout/range/type_traits/lvalue_range.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_TYPE_TRAITS_HPP
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef SPROUT_RANGE_LVALUE_ITERATOR_HPP
|
||||
#define SPROUT_RANGE_LVALUE_ITERATOR_HPP
|
||||
#ifndef SPROUT_RANGE_TYPE_TRAITS_LVALUE_ITERATOR_HPP
|
||||
#define SPROUT_RANGE_TYPE_TRAITS_LVALUE_ITERATOR_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
|
@ -21,4 +21,4 @@ namespace sprout {
|
|||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_LVALUE_ITERATOR_HPP
|
||||
#endif // #ifndef SPROUT_RANGE_TYPE_TRAITS_LVALUE_ITERATOR_HPP
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef SPROUT_RANGE_LVALUE_RANGE_HPP
|
||||
#define SPROUT_RANGE_LVALUE_RANGE_HPP
|
||||
#ifndef SPROUT_RANGE_TYPE_TRAITS_LVALUE_RANGE_HPP
|
||||
#define SPROUT_RANGE_TYPE_TRAITS_LVALUE_RANGE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/range_container.hpp>
|
||||
#include <sprout/range/lvalue_iterator.hpp>
|
||||
#include <sprout/range/type_traits/lvalue_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
|
@ -18,4 +18,4 @@ namespace sprout {
|
|||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_LVALUE_RANGE_HPP
|
||||
#endif // #ifndef SPROUT_RANGE_TYPE_TRAITS_LVALUE_RANGE_HPP
|
Loading…
Reference in a new issue