WeekUp
WeekUp

Reputation: 3

C++ std::begin(c) for vs 2008

I need to use std::begin/end in vs 2008. I get:

'begin' : is not a member of 'std' when I try to compile. Are there any solution?

Upvotes: 0

Views: 189

Answers (1)

Jarod42
Jarod42

Reputation: 218148

std::begin/std::end have been introduce in C++11, if your compiler is too old to support it, you may upgrade your compiler or implement your own functions:

For C-array:

template <typename T, std::size_t N>
T* begin(T (&a)[N]) { return a; }

template <typename T, std::size_t N>
T* end(T (&a)[N]) { return a + N; }

Upvotes: 4

Related Questions