2012-03-31 07:24:13 +00:00
|
|
|
#ifndef SPROUT_CONTAINER_END_HPP
|
|
|
|
#define SPROUT_CONTAINER_END_HPP
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <sprout/config.hpp>
|
|
|
|
#include <sprout/container/container_traits.hpp>
|
2013-04-22 04:04:27 +00:00
|
|
|
#include <sprout/container/container_range_traits.hpp>
|
2012-09-29 08:10:46 +00:00
|
|
|
#include <sprout/adl/not_found.hpp>
|
|
|
|
|
|
|
|
namespace sprout_adl {
|
2012-09-29 14:39:00 +00:00
|
|
|
sprout::not_found_via_adl range_end(...);
|
2012-09-29 08:10:46 +00:00
|
|
|
} // namespace sprout_adl
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace container_detail {
|
|
|
|
template<typename Container>
|
2013-04-22 04:04:27 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::iterator
|
2012-09-29 08:10:46 +00:00
|
|
|
range_end(Container& cont) {
|
2013-04-22 04:04:27 +00:00
|
|
|
return sprout::container_range_traits<Container>::range_end(cont);
|
2012-09-29 08:10:46 +00:00
|
|
|
}
|
|
|
|
template<typename Container>
|
2013-04-22 04:04:27 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
2012-09-29 08:10:46 +00:00
|
|
|
range_end(Container const& cont) {
|
2013-04-22 04:04:27 +00:00
|
|
|
return sprout::container_range_traits<Container>::range_end(cont);
|
2012-12-21 13:35:48 +00:00
|
|
|
}
|
2012-09-29 08:10:46 +00:00
|
|
|
} // namespace container_detail
|
2012-03-31 07:24:13 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// end
|
|
|
|
//
|
|
|
|
template<typename Container>
|
2013-04-22 04:04:27 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::iterator
|
2012-07-21 03:12:11 +00:00
|
|
|
end(Container& cont) {
|
2012-09-29 08:10:46 +00:00
|
|
|
using sprout::container_detail::range_end;
|
|
|
|
using sprout_adl::range_end;
|
|
|
|
return range_end(cont);
|
|
|
|
}
|
|
|
|
template<typename Container>
|
2013-04-22 04:04:27 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
2012-09-29 08:10:46 +00:00
|
|
|
end(Container const& cont) {
|
|
|
|
using sprout::container_detail::range_end;
|
|
|
|
using sprout_adl::range_end;
|
|
|
|
return range_end(cont);
|
2012-03-31 07:24:13 +00:00
|
|
|
}
|
|
|
|
template<typename T, std::size_t N>
|
2013-04-22 04:04:27 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<T[N]>::iterator
|
2012-07-21 03:12:11 +00:00
|
|
|
end(T (& arr)[N]) {
|
2012-12-21 13:35:48 +00:00
|
|
|
return sprout::container_detail::range_end(arr);
|
2012-03-31 07:24:13 +00:00
|
|
|
}
|
|
|
|
template<typename T, std::size_t N>
|
2013-04-22 04:04:27 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<T const[N]>::iterator
|
2012-07-21 03:12:11 +00:00
|
|
|
end(T const (& arr)[N]) {
|
2012-12-21 13:35:48 +00:00
|
|
|
return sprout::container_detail::range_end(arr);
|
2012-03-31 07:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// cend
|
|
|
|
//
|
|
|
|
template<typename Container>
|
2013-04-22 04:04:27 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
2012-07-21 03:12:11 +00:00
|
|
|
cend(Container const& cont) {
|
2012-09-29 08:10:46 +00:00
|
|
|
using sprout::container_detail::range_end;
|
|
|
|
using sprout_adl::range_end;
|
|
|
|
return range_end(cont);
|
2012-03-31 07:24:13 +00:00
|
|
|
}
|
|
|
|
template<typename T, std::size_t N>
|
2013-04-22 04:04:27 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<T const[N]>::iterator
|
2012-07-21 03:12:11 +00:00
|
|
|
cend(T const (& arr)[N]) {
|
2012-12-21 13:35:48 +00:00
|
|
|
return sprout::container_detail::range_end(arr);
|
2012-03-31 07:24:13 +00:00
|
|
|
}
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_CONTAINER_END_HPP
|