mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix adapt interface (range functions)
This commit is contained in:
parent
36e0b187c0
commit
4cceea862f
11 changed files with 479 additions and 585 deletions
|
@ -12,58 +12,38 @@
|
|||
#include <sprout/workaround/std/cstddef.hpp>
|
||||
#include <sprout/container/traits_fwd.hpp>
|
||||
#include <sprout/container/container_traits.hpp>
|
||||
#include <sprout/adl/not_found.hpp>
|
||||
|
||||
namespace sprout_adl {
|
||||
sprout::not_found_via_adl range_begin(...);
|
||||
} // namespace sprout_adl
|
||||
|
||||
namespace sprout {
|
||||
namespace container_detail {
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::iterator
|
||||
range_begin(Container& cont) {
|
||||
return sprout::container_range_traits<Container>::range_begin(cont);
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
||||
range_begin(Container const& cont) {
|
||||
return sprout::container_range_traits<Container>::range_begin(cont);
|
||||
}
|
||||
} // namespace container_detail
|
||||
|
||||
//
|
||||
// begin
|
||||
//
|
||||
// effect:
|
||||
// ADL callable range_begin(cont) -> range_begin(cont)
|
||||
// otherwise -> sprout::container_range_traits<Container>::range_begin(cont)
|
||||
// sprout::container_range_traits<Container>::range_begin(cont)
|
||||
// [default]
|
||||
// cont.begin()
|
||||
// ADL callable range_begin(cont) -> range_begin(cont)
|
||||
// [default]
|
||||
// Container is T[N] -> iterator(cont)
|
||||
// otherwise -> cont.begin()
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::iterator
|
||||
begin(Container& cont) {
|
||||
using sprout::container_detail::range_begin;
|
||||
using sprout_adl::range_begin;
|
||||
return range_begin(cont);
|
||||
return sprout::container_range_traits<Container>::range_begin(cont);
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
||||
begin(Container const& cont) {
|
||||
using sprout::container_detail::range_begin;
|
||||
using sprout_adl::range_begin;
|
||||
return range_begin(cont);
|
||||
return sprout::container_range_traits<Container const>::range_begin(cont);
|
||||
}
|
||||
template<typename T, std::size_t N>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<T[N]>::iterator
|
||||
begin(T (& arr)[N]) {
|
||||
return sprout::container_detail::range_begin(arr);
|
||||
return sprout::container_range_traits<T[N]>::range_begin(arr);
|
||||
}
|
||||
template<typename T, std::size_t N>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<T const[N]>::iterator
|
||||
begin(T const (& arr)[N]) {
|
||||
return sprout::container_detail::range_begin(arr);
|
||||
return sprout::container_range_traits<T const[N]>::range_begin(arr);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue