2012-03-31 07:24:13 +00:00
|
|
|
#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>
|
2012-07-21 03:12:11 +00:00
|
|
|
inline typename sprout::container_traits<Container>::iterator
|
|
|
|
begin(Container& cont) {
|
2012-03-31 07:24:13 +00:00
|
|
|
return cont.begin();
|
|
|
|
}
|
|
|
|
template<typename T, std::size_t N>
|
2012-07-21 03:12:11 +00:00
|
|
|
inline typename sprout::container_traits<T[N]>::iterator
|
|
|
|
begin(T (& arr)[N]) {
|
2012-03-31 07:24:13 +00:00
|
|
|
return arr;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename Container>
|
2012-07-21 03:12:11 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::const_iterator
|
|
|
|
begin(Container const& cont) {
|
2012-03-31 07:24:13 +00:00
|
|
|
return cont.begin();
|
|
|
|
}
|
|
|
|
template<typename T, std::size_t N>
|
2012-07-21 03:12:11 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<T const[N]>::const_iterator
|
|
|
|
begin(T const (& arr)[N]) {
|
2012-03-31 07:24:13 +00:00
|
|
|
return arr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// cbegin
|
|
|
|
//
|
|
|
|
template<typename Container>
|
2012-07-21 03:12:11 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<Container>::const_iterator
|
|
|
|
cbegin(Container const& cont) {
|
2012-03-31 07:24:13 +00:00
|
|
|
return cont.begin();
|
|
|
|
}
|
|
|
|
template<typename T, std::size_t N>
|
2012-07-21 03:12:11 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename sprout::container_traits<T const[N]>::const_iterator
|
|
|
|
cbegin(T const (& arr)[N]) {
|
2012-03-31 07:24:13 +00:00
|
|
|
return arr;
|
|
|
|
}
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_CONTAINER_BEGIN_HPP
|