File indexing completed on 2025-01-18 10:12:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef __TBB_range_iterator_H
0018 #define __TBB_range_iterator_H
0019
0020 #include "../tbb_stddef.h"
0021
0022 #if __TBB_CPP11_STD_BEGIN_END_PRESENT && __TBB_CPP11_AUTO_PRESENT && __TBB_CPP11_DECLTYPE_PRESENT
0023 #include <iterator>
0024 #endif
0025
0026 namespace tbb {
0027
0028 namespace internal {
0029
0030 #if __TBB_CPP11_STD_BEGIN_END_PRESENT && __TBB_CPP11_AUTO_PRESENT && __TBB_CPP11_DECLTYPE_PRESENT
0031 using std::begin;
0032 using std::end;
0033 template<typename Container>
0034 auto first(Container& c)-> decltype(begin(c)) {return begin(c);}
0035
0036 template<typename Container>
0037 auto first(const Container& c)-> decltype(begin(c)) {return begin(c);}
0038
0039 template<typename Container>
0040 auto last(Container& c)-> decltype(begin(c)) {return end(c);}
0041
0042 template<typename Container>
0043 auto last(const Container& c)-> decltype(begin(c)) {return end(c);}
0044 #else
0045 template<typename Container>
0046 typename Container::iterator first(Container& c) {return c.begin();}
0047
0048 template<typename Container>
0049 typename Container::const_iterator first(const Container& c) {return c.begin();}
0050
0051 template<typename Container>
0052 typename Container::iterator last(Container& c) {return c.end();}
0053
0054 template<typename Container>
0055 typename Container::const_iterator last(const Container& c) {return c.end();}
0056 #endif
0057
0058 template<typename T, size_t size>
0059 T* first(T (&arr) [size]) {return arr;}
0060
0061 template<typename T, size_t size>
0062 T* last(T (&arr) [size]) {return arr + size;}
0063 }
0064 }
0065
0066 #endif