rttr  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
array_accessor.h
Go to the documentation of this file.
1 /************************************************************************************
2 * *
3 * Copyright (c) 2014 Axel Menzel <info@axelmenzel.de> *
4 * *
5 * This file is part of RTTR (Run Time Type Reflection) *
6 * License: MIT License *
7 * *
8 * Permission is hereby granted, free of charge, to any person obtaining *
9 * a copy of this software and associated documentation files (the "Software"), *
10 * to deal in the Software without restriction, including without limitation *
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
12 * and/or sell copies of the Software, and to permit persons to whom the *
13 * Software is furnished to do so, subject to the following conditions: *
14 * *
15 * The above copyright notice and this permission notice shall be included in *
16 * all copies or substantial portions of the Software. *
17 * *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *
24 * SOFTWARE. *
25 * *
26 *************************************************************************************/
27 
28 #ifndef __RTTR_ARRAY_ACCESSOR_H__
29 #define __RTTR_ARRAY_ACCESSOR_H__
30 
32 #include "rttr/detail/utility.h"
33 #include "rttr/detail/argument.h"
35 #include "rttr/variant.h"
36 #include <type_traits>
37 #include <cstddef>
38 
39 namespace rttr
40 {
41 class type;
42 namespace detail
43 {
45 
46 template<typename ArrayType, typename B>
47 struct get_size_from_array_impl;
48 
49 template<typename ArrayType>
50 struct get_size_from_array_impl<ArrayType, std::true_type>
51 {
52  template<typename... Indices>
53  static std::size_t get_size(const ArrayType& array, std::size_t index, Indices... args)
54  {
55  using sub_type = typename array_mapper<ArrayType>::sub_type;
56  using go_one_dim_deeper = typename std::integral_constant<bool, (sizeof...(Indices) > 0)>::type;
57  return get_size_from_array_impl<sub_type, go_one_dim_deeper>::get_size(array_mapper<ArrayType>::get_value(array, index), args...);
58  }
59 };
60 
61 template<typename ArrayType>
62 struct get_size_from_array_impl<ArrayType, std::false_type>
63 {
64  static std::size_t get_size(const ArrayType& array)
65  {
66  return array_mapper<ArrayType>::get_size(array);
67  }
68 };
69 
70 
71 template<typename ArrayType, typename... Indices>
72 std::size_t get_size_from_array(const ArrayType& array, Indices... args)
73 {
74  using go_one_dim_deeper = typename std::integral_constant<bool, (sizeof...(Indices) > 0) >::type;
75  return get_size_from_array_impl<ArrayType, go_one_dim_deeper>::get_size(array, args...);
76 }
77 
79 
80 template<typename ArrayType, typename B>
81 struct set_size_to_array_impl;
82 
83 template<typename ArrayType>
84 struct set_size_to_array_impl<ArrayType, std::true_type>
85 {
86  template<typename... Indices>
87  static bool set_size(ArrayType& array, std::size_t new_size, std::size_t index, Indices... args)
88  {
89  using sub_type = typename array_mapper<ArrayType>::sub_type;
90  using go_one_dim_deeper = typename std::integral_constant<bool, (sizeof...(Indices) > 0)>::type;
91  return set_size_to_array_impl<sub_type, go_one_dim_deeper>::set_size(array_mapper<ArrayType>::get_value(array, index), new_size, args...);
92  }
93 };
94 
95 template<typename ArrayType>
96 struct set_size_to_array_impl<ArrayType, std::false_type>
97 {
98  static bool set_size(ArrayType& array, std::size_t new_size)
99  {
100  return array_mapper<ArrayType>::set_size(array, new_size);
101  }
102 };
103 
104 
105 template<typename ArrayType, typename... Indices>
106 bool set_size_to_array(ArrayType& array, std::size_t new_size, Indices... args)
107 {
108  using go_one_dim_deeper = typename std::integral_constant<bool, (sizeof...(Indices) > 0) >::type;
109  return set_size_to_array_impl<ArrayType, go_one_dim_deeper>::set_size(array, new_size, args...);
110 }
111 
113 
114 template<typename Return_Type, typename ArrayType, typename B>
115 struct get_value_from_array_impl;
116 
117 template<typename Return_Type, typename ArrayType>
118 struct get_value_from_array_impl<Return_Type, ArrayType, std::true_type>
119 {
120  template<typename... Indices>
121  static const Return_Type& get_value(const ArrayType& array, std::size_t index, Indices... args)
122  {
123  using sub_type = typename array_mapper<ArrayType>::sub_type;
124  using arg_count_valid = typename std::integral_constant<bool, sizeof...(Indices) != 0>::type;
125  return get_value_from_array_impl<Return_Type, sub_type, arg_count_valid>::get_value(array_mapper<ArrayType>::get_value(array, index), args...);
126  }
127 };
128 
129 template<typename Return_Type, typename T>
130 struct get_value_from_array_impl<Return_Type, T, std::false_type>
131 {
132  template<typename... Indices>
133  static const Return_Type& get_value(const T& value, Indices... args)
134  {
135  return value;
136  }
137 };
138 
139 template<typename ArrayType, typename... Indices>
140 variant get_value_from_array(const ArrayType& array, std::size_t index, Indices... args)
141 {
142  static_assert(rank<ArrayType>::value >= sizeof...(Indices) + 1, "Invalid return type! The number of specified indices are out of range.");
143  using return_type = typename rank_type<ArrayType, sizeof...(Indices) + 1>::type;
144  using sub_type = typename array_mapper<ArrayType>::sub_type;
145  using go_one_dim_deeper = typename std::integral_constant<bool, sizeof...(Indices) != 0>::type;
146  return get_value_from_array_impl<return_type, sub_type, go_one_dim_deeper>::get_value(array_mapper<ArrayType>::get_value(array, index), args...);
147 }
148 
150 
151 template<typename ArrayType, typename B>
152 struct set_value_to_array_impl;
153 
154 template<typename ArrayType>
155 struct set_value_to_array_impl<ArrayType, std::true_type>
156 {
157  template<typename T1, typename... Indices>
158  static void set_value(ArrayType& array, const T1& value, std::size_t index, Indices... args)
159  {
160  using sub_type = typename array_mapper<ArrayType>::sub_type;
161  using arg_count_valid = typename std::integral_constant<bool, sizeof...(Indices) != 0>::type;
162  set_value_to_array_impl<sub_type, arg_count_valid>::set_value(array_mapper<ArrayType>::get_value(array, index), value, args...);
163  }
164 };
165 
166 template<typename T>
167 struct set_value_to_array_impl<T, std::false_type>
168 {
169  static void set_value(T& array, const T& value)
170  {
171  array = value;
172  }
173 };
174 
175 template<typename T, size_t N>
176 struct set_value_to_array_impl<T[N], std::false_type>
177 {
178  static void set_value(T (& arr)[N], const T (& value)[N])
179  {
180 #if RTTR_COMPILER == RTTR_COMPILER_MSVC
181 // MSVC is to dumb to let use use the above code, so we have to develop a workaround
182 // https://connect.microsoft.com/VisualStudio/feedback/details/884930/strange-ambiguous-compile-error-when-forwarding-multi-dimensional-arrays
183  copy_array(const_cast< T (&)[N]>(value), arr);
184 #else
185  copy_array(value, arr);
186 #endif
187  }
188 };
189 
190 template<typename ArrayType, typename F, typename... Indices>
191 bool set_value_to_array(ArrayType& array, const F& value, std::size_t index, Indices... args)
192 {
193  // MSVC is to dumb to let us put this in the argument list
194  static_assert(std::is_same<typename rank_type<ArrayType, sizeof...(Indices) + 1>::type, F>::value, "invalid type!");
195  using sub_type = typename array_mapper<ArrayType>::sub_type;
196  using go_one_dim_deeper = typename std::integral_constant<bool, sizeof...(Indices) != 0>::type;
197  set_value_to_array_impl<sub_type, go_one_dim_deeper>::set_value(array_mapper<ArrayType>::get_value(array, index), value, args...);
198  return true;
199 }
200 
201 template<typename T>
202 bool set_value_to_array(T& arg, const T& value)
203 {
204  set_value_to_array_impl<T, std::false_type>::set_value(arg, value);
205  return true;
206 }
207 
209 
210 
211 template<typename ArrayType, typename B>
212 struct insert_value_to_array_impl;
213 
214 template<typename ArrayType>
215 struct insert_value_to_array_impl<ArrayType, std::true_type>
216 {
217  template<typename T, typename... Indices>
218  static bool insert_value(ArrayType& array, const T& value, std::size_t index, Indices... args)
219  {
220  using sub_type = typename array_mapper<ArrayType>::sub_type;
221  using arg_count_valid = typename std::integral_constant<bool, (sizeof...(Indices) > 1)>::type;
222  return insert_value_to_array_impl<sub_type, arg_count_valid>::insert_value(array_mapper<ArrayType>::get_value(array, index), value, args...);
223  }
224 };
225 
226 template<typename ArrayType>
227 struct insert_value_to_array_impl<ArrayType, std::false_type>
228 {
229  template<typename T>
230  static bool insert_value(ArrayType& array, const T& value, std::size_t index)
231  {
232  return array_mapper<ArrayType>::insert_value(array, value, index);
233  }
234 };
235 
236 
237 template<typename ArrayType, typename F, typename... Indices>
238 bool insert_value_to_array(ArrayType& array, const F& value, Indices... args)
239 {
240  using go_one_dim_deeper = typename std::integral_constant<bool, (sizeof...(Indices) > 1) >::type;
241  return insert_value_to_array_impl<ArrayType, go_one_dim_deeper>::insert_value(array, value, args...);
242 }
243 
245 
246 
247 template<typename ArrayType, typename B>
248 struct remove_value_from_array_impl;
249 
250 template<typename ArrayType>
251 struct remove_value_from_array_impl<ArrayType, std::true_type>
252 {
253  template<typename... Indices>
254  static bool remove_value(ArrayType& array, std::size_t index, Indices... args)
255  {
256  using sub_type = typename array_mapper<ArrayType>::sub_type;
257  using arg_count_valid = typename std::integral_constant<bool, (sizeof...(Indices) > 1) >::type;
258  return remove_value_from_array_impl<sub_type, arg_count_valid>::remove_value(array_mapper<ArrayType>::get_value(array, index), args...);
259  }
260 };
261 
262 template<typename ArrayType>
263 struct remove_value_from_array_impl<ArrayType, std::false_type>
264 {
265  static bool remove_value(ArrayType& array, std::size_t index)
266  {
267  return array_mapper<ArrayType>::remove_value(array, index);
268  }
269 };
270 
271 
272 template<typename ArrayType, typename... Indices>
273 bool remove_value_from_array(ArrayType& array, Indices... args)
274 {
275  using go_one_dim_deeper = typename std::integral_constant<bool, (sizeof...(Indices) > 1) >::type;
276  return remove_value_from_array_impl<ArrayType, go_one_dim_deeper>::remove_value(array, args...);
277 }
278 
280 
281 template<typename ArrayType, typename A>
282 struct array_accessor_impl;
283 
284 template<typename ArrayType>
285 struct array_accessor_impl<ArrayType, std::true_type>
286 {
288 
289  template<typename... Indices>
290  static std::size_t get_size(const ArrayType& obj, Indices... args)
291  {
292  return get_size_from_array<ArrayType>(obj, args...);
293  }
294 
296 
297  template<typename... Indices>
298  static bool set_size(ArrayType& obj, std::size_t new_size, Indices... args)
299  {
300  return set_size_to_array<ArrayType>(obj, new_size, args...);
301  }
302 
304 
305  template<typename... Indices>
306  static variant get_value(const ArrayType& obj, Indices... indices)
307  {
308  return get_value_from_array<ArrayType>(obj, indices...);
309  }
310 
312 
313  template<typename... Indices>
314  static bool set_value(ArrayType& obj, argument& arg, Indices... indices)
315  {
316  using arg_type = typename rank_type<ArrayType, sizeof...(Indices)>::type;
317  if (arg.is_type<arg_type>())
318  return set_value_to_array<ArrayType>(obj, arg.get_value<arg_type>(), indices...);
319  else
320  return false;
321  }
322 
324 
325  template<typename... Indices>
326  static bool insert_value(ArrayType& obj, argument& arg, Indices... indices)
327  {
328  using arg_type = typename rank_type<ArrayType, sizeof...(Indices)>::type;
329  if (arg.is_type<arg_type>())
330  return insert_value_to_array<ArrayType>(obj, arg.get_value<arg_type>(), indices...);
331  else
332  return false;
333  }
334 
336 
337  template<typename... Indices>
338  static bool remove_value(ArrayType& obj, Indices... indices)
339  {
340  return remove_value_from_array<ArrayType>(obj, indices...);
341  }
342 
344 };
345 
346 // index count is bigger then the array rank => invalid call
347 template<typename ArrayType>
348 struct array_accessor_impl<ArrayType, std::false_type>
349 {
351 
352  template<typename... Indices>
353  static std::size_t get_size(const ArrayType& obj, Indices... args)
354  {
355  return 0;
356  }
357 
358  template<typename... Indices>
359  static bool set_size(ArrayType& obj, std::size_t new_size, Indices... args)
360  {
361  return false;
362  }
363 
365 
366  template<typename... Indices>
367  static variant get_value(const ArrayType& obj, Indices... indices)
368  {
369  return variant();
370  }
371 
373 
374  template<typename... Indices>
375  static bool set_value(ArrayType& obj, argument& arg, Indices... indices)
376  {
377  return false;
378  }
379 
381 
382  template<typename... Indices>
383  static bool insert_value(ArrayType& obj, argument& arg, Indices... indices)
384  {
385  return false;
386  }
387 
389 
390  template<typename... Indices>
391  static bool remove_value(ArrayType& obj, Indices... indices)
392  {
393  return false;
394  }
395 
397 };
398 
399 
400 template<typename T, typename IndexCount>
401 struct array_accessor_variadic;
402 
403 template<typename ArrayType, std::size_t... N>
404 struct array_accessor_variadic<ArrayType, index_sequence<N...>>
405 {
407 
408  static std::size_t get_size(const ArrayType& obj, const std::vector<std::size_t>& index_list)
409  {
410  using is_rank_in_range = typename std::integral_constant< bool, (sizeof...(N) < rank<ArrayType>::value) >::type;
411  return array_accessor_impl<ArrayType, is_rank_in_range>::get_size(obj, index_list[N]...);
412  }
413 
415 
416  static bool set_size(ArrayType& obj, std::size_t new_size, const std::vector<std::size_t>& index_list)
417  {
418  using is_rank_in_range = typename std::integral_constant< bool, (sizeof...(N) < rank<ArrayType>::value) >::type;
419  return array_accessor_impl<ArrayType, is_rank_in_range>::set_size(obj, new_size, index_list[N]...);
420  }
421 
423 
424  static variant get_value(const ArrayType& obj, const std::vector<std::size_t>& index_list)
425  {
426  using is_rank_in_range = typename std::integral_constant<bool, (sizeof...(N) <= rank<ArrayType>::value) >::type;
427  return array_accessor_impl<ArrayType, is_rank_in_range>::get_value(obj, index_list[N]...);
428  }
429 
431 
432  static bool set_value(ArrayType& obj, argument& arg, const std::vector<std::size_t>& index_list)
433  {
434  using is_rank_in_range = typename std::integral_constant<bool, (sizeof...(N) <= rank<ArrayType>::value) >::type;
435  return array_accessor_impl<ArrayType, is_rank_in_range>::set_value(obj, arg, index_list[N]...);
436  }
437 
439 
440  static bool insert_value(ArrayType& obj, argument& arg, const std::vector<std::size_t>& index_list)
441  {
442  using is_rank_in_range = typename std::integral_constant<bool, (sizeof...(N) < rank<ArrayType>::value) >::type;
443  return array_accessor_impl<ArrayType, is_rank_in_range>::insert_value(obj, arg, index_list[N]...);
444  }
445 
447 
448  static bool remove_value(ArrayType& obj, const std::vector<std::size_t>& index_list)
449  {
450  using is_rank_in_range = typename std::integral_constant<bool, (sizeof...(N) < rank<ArrayType>::value) >::type;
451  return array_accessor_impl<ArrayType, is_rank_in_range>::remove_value(obj, index_list[N]...);
452  }
453 
455 };
456 
457 template<typename ArrayType, std::size_t N>
458 struct array_accessor_impl<ArrayType, std::integral_constant<std::size_t, N>>
459 {
461 
462  static std::size_t get_size(const ArrayType& obj, const std::vector<std::size_t>& index_list)
463  {
464  if (index_list.size() == N)
465  return array_accessor_variadic<ArrayType, make_index_sequence<N>>::get_size(obj, index_list);
466  else
467  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, N - 1>>::get_size(obj, index_list);
468  }
469 
471 
472  static bool set_size(ArrayType& obj, std::size_t new_size, const std::vector<std::size_t>& index_list)
473  {
474  if (index_list.size() == N)
475  return array_accessor_variadic<ArrayType, make_index_sequence<N>>::set_size(obj, new_size, index_list);
476  else
477  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, N - 1>>::set_size(obj, new_size, index_list);
478  }
479 
481 
482  static variant get_value(const ArrayType& obj, const std::vector<std::size_t>& index_list)
483  {
484  if (index_list.size() == N)
485  return array_accessor_variadic<ArrayType, make_index_sequence<N>>::get_value(obj, index_list);
486  else
487  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, N - 1>>::get_value(obj, index_list);
488  }
489 
491 
492  static bool set_value(ArrayType& obj, argument& arg, const std::vector<std::size_t>& index_list)
493  {
494  if (index_list.size() == N)
495  return array_accessor_variadic<ArrayType, make_index_sequence<N>>::set_value(obj, arg, index_list);
496  else
497  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, N - 1>>::set_value(obj, arg, index_list);
498  }
499 
501 
502  static bool insert_value(ArrayType& obj, argument& arg, const std::vector<std::size_t>& index_list)
503  {
504  if (index_list.size() == N)
505  return array_accessor_variadic<ArrayType, make_index_sequence<N>>::insert_value(obj, arg, index_list);
506  else
507  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, N - 1>>::insert_value(obj, arg, index_list);
508  }
509 
511 
512  static bool remove_value(ArrayType& obj, const std::vector<std::size_t>& index_list)
513  {
514  if (index_list.size() == N)
515  return array_accessor_variadic<ArrayType, make_index_sequence<N>>::remove_value(obj, index_list);
516  else
517  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, N - 1>>::remove_value(obj, index_list);
518  }
519 
521 
522  static type get_ranke_type(std::size_t index)
523  {
524  if (index == N)
525  return type::get<typename rank_type<ArrayType, N>::type>();
526  else
527  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, N - 1>>::get_ranke_type(index);
528  }
529 };
530 
531 template<typename ArrayType>
532 struct array_accessor_impl<ArrayType, std::integral_constant<std::size_t, 0>>
533 {
535 
536  static std::size_t get_size(const ArrayType& obj, const std::vector<std::size_t>& index_list)
537  {
538  return array_accessor_impl<ArrayType, std::true_type>::get_size(obj);
539  }
540 
542 
543  static bool set_size(ArrayType& obj, std::size_t new_size, const std::vector<std::size_t>& index_list)
544  {
545  return array_accessor_impl<ArrayType, std::true_type>::set_size(obj, new_size);
546  }
547 
549 
550  static variant get_value(const ArrayType& obj, const std::vector<std::size_t>& index_list)
551  {
552  return variant(); // one index at least needed, otherwise the whole array would be returned
553  }
554 
556 
557  static bool set_value(ArrayType& obj, argument& arg, const std::vector<std::size_t>& index_list)
558  {
559  // copy the whole array
560  return array_accessor_impl<ArrayType, std::true_type>::set_value(obj, arg);
561  }
562 
564 
565  static bool insert_value(ArrayType& obj, argument& arg, const std::vector<std::size_t>& index_list)
566  {
567  return false;
568  }
569 
571 
572  static bool remove_value(ArrayType& obj, const std::vector<std::size_t>& index_list)
573  {
574  return false;
575  }
576 
578 
579  static type get_ranke_type(std::size_t index)
580  {
581  return type::get<typename rank_type<ArrayType, 0>::type>();
582  }
583 
585 };
586 
587 template<typename ArrayType>
588 struct array_accessor
589 {
591 
592  template<typename... Indices>
593  static std::size_t get_size(const ArrayType& array, Indices... args)
594  {
595  using is_rank_in_range = typename std::integral_constant< bool, (sizeof...(Indices) < rank<ArrayType>::value) >::type;
596  return array_accessor_impl<ArrayType, is_rank_in_range>::get_size(array, args...);
597  }
598 
599  static std::size_t get_size(const ArrayType& array, const std::vector<std::size_t>& index_list)
600  {
601  if (index_list.size() < rank<ArrayType>::value)
602  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, rank<ArrayType>::value - 1>>::get_size(array, index_list);
603  else
604  return 0;
605  }
606 
608 
609  template<typename... Indices>
610  static bool set_size(ArrayType& array, std::size_t new_size, Indices... args)
611  {
612  using is_rank_in_range = typename std::integral_constant< bool, (sizeof...(Indices) < rank<ArrayType>::value) >::type;
613  return array_accessor_impl<ArrayType, is_rank_in_range>::set_size(array, new_size, args...);
614  }
615 
616  static bool set_size(ArrayType& array, std::size_t new_size, const std::vector<std::size_t>& index_list)
617  {
618  if (index_list.size() < rank<ArrayType>::value)
619  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, rank<ArrayType>::value - 1>>::set_size(array, new_size, index_list);
620  else
621  return false;
622  }
623 
625 
626  template<typename... Indices>
627  static variant get_value(const ArrayType& array, Indices... indices)
628  {
629  using is_rank_in_range = typename std::integral_constant<bool, (sizeof...(Indices) <= rank<ArrayType>::value) >::type;
630  return array_accessor_impl<ArrayType, is_rank_in_range>::get_value(array, indices...);
631  }
632 
633  static variant get_value(const ArrayType& array, const std::vector<std::size_t>& index_list)
634  {
635  if (index_list.size() <= rank<ArrayType>::value)
636  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, rank<ArrayType>::value>>::get_value(array, index_list);
637  else
638  return variant();
639  }
640 
642 
643  template<typename... Indices>
644  static bool set_value(ArrayType& array, argument& arg, Indices... indices)
645  {
646  using is_rank_in_range = typename std::integral_constant<bool, (sizeof...(Indices) <= rank<ArrayType>::value) >::type;
647  return array_accessor_impl<ArrayType, is_rank_in_range>::set_value(array, arg, indices...);
648  }
649 
650  static bool set_value(ArrayType& array, argument& arg, const std::vector<std::size_t>& index_list)
651  {
652  if (index_list.size() <= rank<ArrayType>::value)
653  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, rank<ArrayType>::value>>::set_value(array, arg, index_list);
654  else
655  return false;
656  }
657 
659 
660  template<typename... Indices>
661  static bool insert_value(ArrayType& array, argument& arg, Indices... indices)
662  {
663  using is_rank_in_range = typename std::integral_constant<bool, (sizeof...(Indices) <= rank<ArrayType>::value) >::type;
664  return array_accessor_impl<ArrayType, is_rank_in_range>::insert_value(array, arg, indices...);
665  }
666 
667  static bool insert_value(ArrayType& array, argument& arg, const std::vector<std::size_t>& index_list)
668  {
669  if (index_list.size() < rank<ArrayType>::value)
670  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, rank<ArrayType>::value - 1>>::insert_value(array, arg, index_list);
671  else
672  return false;
673  }
674 
676 
677  template<typename... Indices>
678  static bool remove_value(ArrayType& array, Indices... indices)
679  {
680  using is_rank_in_range = typename std::integral_constant<bool, (sizeof...(Indices) <= rank<ArrayType>::value) >::type;
681  return array_accessor_impl<ArrayType, is_rank_in_range>::remove_value(array, indices...);
682  }
683 
684  static bool remove_value(ArrayType& array, const std::vector<std::size_t>& index_list)
685  {
686  if (index_list.size() < rank<ArrayType>::value)
687  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, rank<ArrayType>::value - 1>>::remove_value(array, index_list);
688  else
689  return false;
690  }
691 
693 
694  static type get_ranke_type(std::size_t index)
695  {
696  if (index <= rank<ArrayType>::value)
697  return array_accessor_impl<ArrayType, std::integral_constant<std::size_t, rank<ArrayType>::value>>::get_ranke_type(index);
698  else
699  return ::rttr::impl::get_invalid_type();
700  }
701 
703 };
704 
705 } // end namespace detail
706 } // end namespace rttr
707 
708 #endif // __RTTR_ARRAY_ACCESSOR_H__