mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-11-29 01:03:45 +00:00
66 lines
2.3 KiB
C++
66 lines
2.3 KiB
C++
/*=============================================================================
|
|
Copyright (c) 2011-2016 Bolero MURAKAMI
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
=============================================================================*/
|
|
#ifndef SPROUT_CONTAINER_END_HPP
|
|
#define SPROUT_CONTAINER_END_HPP
|
|
|
|
#include <sprout/config.hpp>
|
|
#include <sprout/workaround/std/cstddef.hpp>
|
|
#include <sprout/container/traits_fwd.hpp>
|
|
#include <sprout/container/container_traits.hpp>
|
|
|
|
namespace sprout {
|
|
//
|
|
// end
|
|
//
|
|
// effect:
|
|
// sprout::container_range_traits<Container>::range_end(cont)
|
|
// [default]
|
|
// ADL callable range_end(cont) -> range_end(cont)
|
|
// [default]
|
|
// Container is T[N] -> iterator(cont) + N
|
|
// otherwise -> cont.end()
|
|
//
|
|
template<typename Container>
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::iterator
|
|
end(Container& cont) {
|
|
return sprout::container_range_traits<Container>::range_end(cont);
|
|
}
|
|
template<typename Container>
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
|
end(Container const& cont) {
|
|
return sprout::container_range_traits<Container const>::range_end(cont);
|
|
}
|
|
template<typename T, std::size_t N>
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<T[N]>::iterator
|
|
end(T (& arr)[N]) {
|
|
return sprout::container_range_traits<T[N]>::range_end(arr);
|
|
}
|
|
template<typename T, std::size_t N>
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<T const[N]>::iterator
|
|
end(T const (& arr)[N]) {
|
|
return sprout::container_range_traits<T const[N]>::range_end(arr);
|
|
}
|
|
|
|
//
|
|
// cend
|
|
//
|
|
template<typename Container>
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container const>::iterator
|
|
cend(Container const& cont) {
|
|
return sprout::end(cont);
|
|
}
|
|
template<typename T, std::size_t N>
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<T const[N]>::iterator
|
|
cend(T const (& arr)[N]) {
|
|
return sprout::end(arr);
|
|
}
|
|
} // namespace sprout
|
|
|
|
#include <sprout/container/container_range_traits.hpp>
|
|
|
|
#endif // #ifndef SPROUT_CONTAINER_END_HPP
|