libostd/ostd/initializer_list.hh

28 lines
578 B
C++
Raw Normal View History

/* Initializer list support for OctaSTD.
*
* This file is part of OctaSTD. See COPYING.md for futher information.
*/
2015-07-13 21:08:55 +02:00
#ifndef OSTD_INITIALIZER_LIST_HH
#define OSTD_INITIALIZER_LIST_HH
2017-01-14 15:09:27 +01:00
#include <initializer_list>
2015-07-13 21:08:55 +02:00
#include "ostd/range.hh"
2015-07-13 21:07:14 +02:00
namespace ostd {
2015-05-28 20:58:05 +02:00
2015-06-04 23:57:06 +02:00
template<typename T>
2016-09-11 21:17:49 +02:00
PointerRange<T const> iter(std::initializer_list<T> init) noexcept {
2016-06-23 20:18:35 +02:00
return PointerRange<T const>(init.begin(), init.end());
2015-06-03 23:56:01 +02:00
}
2015-06-09 22:18:43 +02:00
template<typename T>
2016-09-11 21:17:49 +02:00
PointerRange<T const> citer(std::initializer_list<T> init) noexcept {
2016-06-23 20:18:35 +02:00
return PointerRange<T const>(init.begin(), init.end());
2015-06-09 22:18:43 +02:00
}
}
2016-02-07 22:17:15 +01:00
#endif