2017-01-25 23:46:48 +01:00
|
|
|
/* OctaSTD extensions for std::array.
|
2015-04-21 18:57:20 +02:00
|
|
|
*
|
|
|
|
* This file is part of OctaSTD. See COPYING.md for futher information.
|
|
|
|
*/
|
|
|
|
|
2015-07-13 21:08:55 +02:00
|
|
|
#ifndef OSTD_ARRAY_HH
|
|
|
|
#define OSTD_ARRAY_HH
|
2015-04-21 18:57:20 +02:00
|
|
|
|
2017-01-25 23:46:48 +01:00
|
|
|
#include <array>
|
2015-04-21 18:57:20 +02:00
|
|
|
|
2015-07-13 21:08:55 +02:00
|
|
|
#include "ostd/range.hh"
|
2015-04-21 18:57:20 +02:00
|
|
|
|
2015-07-13 21:07:14 +02:00
|
|
|
namespace ostd {
|
2015-06-04 00:10:10 +02:00
|
|
|
|
2017-01-25 23:46:48 +01:00
|
|
|
template<typename T, size_t N>
|
2017-01-26 00:27:54 +01:00
|
|
|
struct ranged_traits<std::array<T, N>> {
|
|
|
|
static PointerRange<T> iter(std::array<T, N> &v) {
|
2017-02-09 22:48:28 +01:00
|
|
|
return PointerRange<T>{v.data(), v.data() + N};
|
2017-01-26 00:27:54 +01:00
|
|
|
}
|
|
|
|
};
|
2015-07-11 17:07:52 +02:00
|
|
|
|
2017-01-25 23:46:48 +01:00
|
|
|
template<typename T, size_t N>
|
2017-01-26 00:27:54 +01:00
|
|
|
struct ranged_traits<std::array<T, N> const> {
|
|
|
|
static PointerRange<T const> iter(std::array<T, N> const &v) {
|
2017-02-09 22:48:28 +01:00
|
|
|
return PointerRange<T const>{v.data(), v.data() + N};
|
2017-01-26 00:27:54 +01:00
|
|
|
}
|
|
|
|
};
|
2015-07-11 17:07:52 +02:00
|
|
|
|
2015-07-13 21:07:14 +02:00
|
|
|
} /* namespace ostd */
|
2015-04-21 18:57:20 +02:00
|
|
|
|
2016-02-07 22:17:15 +01:00
|
|
|
#endif
|