mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-11-14 10:39:05 +00:00
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
|
#ifndef SPROUT_CONTAINER_BEGIN_HPP
|
||
|
#define SPROUT_CONTAINER_BEGIN_HPP
|
||
|
|
||
|
#include <cstddef>
|
||
|
#include <sprout/config.hpp>
|
||
|
#include <sprout/container/container_traits.hpp>
|
||
|
|
||
|
namespace sprout {
|
||
|
//
|
||
|
// begin
|
||
|
//
|
||
|
template<typename Container>
|
||
|
inline typename sprout::container_traits<Container>::iterator begin(Container& cont) {
|
||
|
return cont.begin();
|
||
|
}
|
||
|
template<typename T, std::size_t N>
|
||
|
inline typename sprout::container_traits<T[N]>::iterator begin(T (& arr)[N]) {
|
||
|
return arr;
|
||
|
}
|
||
|
|
||
|
template<typename Container>
|
||
|
SPROUT_CONSTEXPR inline typename sprout::container_traits<Container>::const_iterator begin(Container const& cont) {
|
||
|
return cont.begin();
|
||
|
}
|
||
|
template<typename T, std::size_t N>
|
||
|
SPROUT_CONSTEXPR inline typename sprout::container_traits<T const[N]>::const_iterator begin(T const (& arr)[N]) {
|
||
|
return arr;
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// cbegin
|
||
|
//
|
||
|
template<typename Container>
|
||
|
SPROUT_CONSTEXPR inline typename sprout::container_traits<Container>::const_iterator cbegin(Container const& cont) {
|
||
|
return cont.begin();
|
||
|
}
|
||
|
template<typename T, std::size_t N>
|
||
|
SPROUT_CONSTEXPR inline typename sprout::container_traits<T const[N]>::const_iterator cbegin(T const (& arr)[N]) {
|
||
|
return arr;
|
||
|
}
|
||
|
} // namespace sprout
|
||
|
|
||
|
#endif // #ifndef SPROUT_CONTAINER_BEGIN_HPP
|