30 #include "../error/exceptions.hpp"
31 #include "sfinae_macros.hpp"
58 template<
typename CTYPE>
80 static container_type
create(
size_t n,
89 std::fill(c.begin(),c.end(),default_value);
120 static container_type
create(ITERT begin,ITERT end)
122 container_type c(std::distance(begin,end));
123 std::copy(begin,end,c.begin());
151 static container_type
create(
const OCTYPE &o)
153 container_type c(o.size());
154 std::copy(o.begin(),o.end(),c.begin());
179 static container_type
create(
const std::initializer_list<T> &list)
181 container_type c(list.size());
182 std::copy(list.begin(),list.end(),c.begin());
228 static container_type
create(
size_t n,
239 std::stringstream message;
240 message<<
"Number of elements ("<<n<<
") not supported by ";
241 message<<
"array type which has ("<<N<<
")!";
246 std::fill(v.begin(),v.end(),default_value);
280 static container_type
create(ITERT begin,ITERT end)
282 if(N!=std::distance(begin,end))
284 std::stringstream message;
285 message<<
"Iterators span ("<<std::distance(begin,end)<<
")";
286 message<<
" only ("<<N<<
") supported by the array type!";
291 std::copy(begin,end,v.begin());
319 static container_type
create(
const OCTYPE &o)
323 std::stringstream message;
324 message<<
"Original container has ("<<o.size()<<
") elements, ";
325 message<<
"array supports only ("<<N<<
")!";
330 std::copy(o.begin(),o.end(),v.begin());
343 static container_type
create(
const std::array<T,N> &c)
364 template<
typename ET>
371 static container_type
create(
const std::initializer_list<ET> &list)
375 std::stringstream message;
376 message<<
"Initializer list has ("<<list.size()<<
") elements, ";
377 message<<
"array supports only ("<<N<<
")!";
382 std::copy(list.begin(),list.end(),v.begin());
393 template<
typename STYPE>
394 bool check_size(STYPE)
405 bool check_size(STYPE s,
const CTYPE &c,
const CTYPES& ...cs)
407 return s!=c.size()?
false:check_size(c.size(),cs...);
446 return check_size(c.size(),cs...);
static container_type create(size_t n, value_type default_value=value_type())
create container of given size
Definition: container_utils.hpp:85
static container_type create(const std::initializer_list< ET > &list)
initialize std::array from an initializer list
Definition: container_utils.hpp:371
Size mismatch error.
Definition: exceptions.hpp:399
std::is_pointer< T > is_ptr
shortcut for std::is_pointer
Definition: sfinae_macros.hpp:122
#define EXCEPTION_RECORD
macro creating an instance of ExceptionRecord
Definition: exceptions.hpp:48
type erasure array types
Definition: array.hpp:74
logical not
Definition: sfinae_macros.hpp:97
CTYPE::value_type value_type
the element type of the container
Definition: container_utils.hpp:64
container utility
Definition: container_utils.hpp:59
static container_type create(ITERT begin, ITERT end)
create container from a range
Definition: container_utils.hpp:120
Definition: add_op.hpp:29
invoke< std::enable_if< C::value >> enable_if
shortcut for std::enable_if
Definition: sfinae_macros.hpp:108
bool check_equal_size(const CTYPE &c, const CTYPES &...cs)
check container sizes
Definition: container_utils.hpp:444
static container_type create(const OCTYPE &o)
initialize std::array from a container
Definition: container_utils.hpp:319
or type
Definition: sfinae_macros.hpp:60
static container_type create(const std::initializer_list< T > &list)
create from initializer list
Definition: container_utils.hpp:179
CTYPE container_type
type of the container
Definition: container_utils.hpp:62
static container_type create(const std::array< T, N > &c)
create from array
Definition: container_utils.hpp:343
static container_type create(ITERT begin, ITERT end)
initialize std::array from an iterator range
Definition: container_utils.hpp:280
std::array< T, N > container_type
type of the container
Definition: container_utils.hpp:208
T value_type
value type of the container
Definition: container_utils.hpp:210
static container_type create(const OCTYPE &o)
create from another container
Definition: container_utils.hpp:151