00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
01302 #ifndef LITE_ARRAY_HPP
01303 #define LITE_ARRAY_HPP
01304
01305 #include <exception>
01306 #include <stdexcept>
01307 #include <iterator>
01308 #include <algorithm>
01309 #include <iostream>
01310 #include <iomanip>
01311 #include <limits>
01312 #include <cmath>
01313 #include <cstdlib>
01314
01315
01316
01317
01318
01319 #ifdef LITE_INLINE
01320 #undef LITE_INLINE
01321 #endif
01322
01327 #define LITE_ARRAY_MAX_DIMS 3
01328
01333 #define LITE_ARRAY_MAX_PACKS 4
01334
01347 #define LITE_ARRAY_MAX_VECTOR_ARGS 5
01348
01356 #define LITE_ARRAY_MAX_ITERATOR_ARGS 3
01357
01364 #define LITE_ARRAY_MAX_STATIC_UNROLL_LENGTH 5
01365
01374 #define LITE_ARRAY_MAX_DYNAMIC_UNROLL_DEPTH 4
01375
01380 #define LITE_ARRAY_VERSION 3505
01381
01386 #define LITE_ARRAY_VERSION_STR "3.505"
01387
01388 #define LITE_ARRAY_USE(x) ((void)(x))
01389
01390 #ifndef __LINE__ // true when Doxygen is processing the file
01391 #define DOCUMENTATION_ONLY
01392 #endif
01393
01394
01395
01396
01397
01398 #ifdef _MSC_VER
01399
01400 #if _MSC_VER < 1300
01401 #error visual c++ .net 7.1 (2003) or newer is required
01402 #endif // _MSC_VER < 1300
01403
01404 #pragma warning(push)
01405 #pragma warning(disable : 4127) // conditional_c expression is constant
01406 #pragma inline_recursion(on)
01407 #pragma inline_depth(200)
01408
01409 #define LITE_INLINE __forceinline
01410
01411 #ifndef NDEBUG
01412 #pragma message ("lite/array.hpp: Warning! Possible performance penalty due to assertions. Define NDEBUG to disable.")
01413 #endif
01414
01415 #endif // _MSC_VER
01416
01417
01418
01419
01420
01421 #ifdef __GNUC__
01422
01423 #define LITE_INLINE inline __attribute__((always_inline))
01424
01425 #ifndef LITE_ARRAY_NO_HINT
01426 #warning "Use the following compiler switches to get a good performance: -finline-limit=1234567 --param large-function-growth=1234567 --param max-inline-insns-single=1234567"
01427 #warning "Define LITE_ARRAY_NO_HINT to disable the previous warning."
01428 #endif
01429
01430 #ifndef NDEBUG
01431 #warning "lite/array.hpp: Possible performance penalty due to assertions. Define NDEBUG to disable."
01432 #endif
01433
01434 #endif // __GNUC__
01435
01436
01437
01438
01439
01440 #ifndef LITE_INLINE
01441 #define LITE_INLINE inline
01442 #endif
01443
01444
01445
01446
01447
01448 #ifdef NDEBUG
01449 #define LITE_ARRAY_SIZE_CHECK(size1, size2, msg)
01450 #else
01451 #define LITE_ARRAY_SIZE_CHECK(size1, size2, msg) lite_array_size_check(size1, size2, msg)
01452 #endif
01453
01454
01455
01456
01457
01459 namespace lite
01460 {
01461
01462 template<typename type_, type_ value_>
01463 class constant;
01464
01465 template<
01466 typename type0_ = void ,
01467 typename type1_ = void ,
01468 typename type2_ = void ,
01469 typename type3_ = void
01470 >
01471 class pack;
01472
01473 template<
01474 typename pack_type_,
01475 bool keep0_ =false,
01476 bool keep1_ =false,
01477 bool keep2_ =false,
01478 bool keep3_ =false
01479 >
01480 class sub_pack;
01481
01482
01483
01484 template<typename _value_type>
01485 class c_iterator;
01486
01487 template<
01488 typename base_iter_type_,
01489 typename func_type_,
01490 bool is_static_ =true>
01491 class u_iterator;
01492
01493 template<
01494 typename left_base_iter_type_,
01495 typename right_base_iter_type_,
01496 typename func_type_,
01497 bool is_static_=true>
01498 class b_iterator;
01499
01500 template<typename signature_, typename base_iterator_type_=void>
01501 struct array_signature_traits;
01502
01503 template<typename iterator_type_>
01504 class reference_rep;
01505
01506 template<bool reversed_>
01507 class internal_rep;
01508
01509 template<bool reversed_, int internal_buf_size_>
01510 class hybrid_rep;
01511
01512 struct default_array_traits;
01513
01514 template<
01515 typename signature_,
01516 typename traits_type_ = default_array_traits,
01517 typename rep_ = typename traits_type_::template representation_type<signature_>::type>
01518 class array;
01519
01520 template<typename signature_, typename traits_type_ = default_array_traits>
01521 struct array_helper;
01522
01523 template<typename trans_type_, typename size_type_>
01524 struct size_transformer;
01525
01526 template<typename trans_type_, typename iter_type_, typename size_type_>
01527 struct iterator_transformer;
01528
01529 template<typename array_type_, typename trans_type_, typename enabler_=void>
01530 struct transform_traits;
01531
01532 template<int dim_>
01533 class plane;
01534
01556 typedef plane<0> row;
01557
01579 typedef plane<1> column;
01580
01581 class diagonal;
01582
01583 class transpose;
01584
01585 template<
01586 int n0_ = -2,
01587 int n1_ = -2,
01588 int n2_ = -2
01589 >
01590 class block;
01591
01592 class array_comparator;
01593
01594 class size_mismatch_error;
01595
01604 namespace transforms
01605 {
01606 using ::lite::plane;
01607 using ::lite::row;
01608 using ::lite::column;
01609 using ::lite::diagonal;
01610 using ::lite::transpose;
01611 using ::lite::block;
01612 using ::lite::transform_traits;
01613 };
01614
01615
01616
01617
01618
01619 namespace detail
01620 {
01621
01622
01623
01624
01625
01626 template<bool cond_, typename type_ =void>
01627 struct enable_if;
01628
01629 template<typename type_>
01630 struct enable_if<false, type_>
01631 {};
01632
01633 template<typename type_>
01634 struct enable_if<true, type_>
01635 {
01636 typedef type_ type;
01637 };
01638
01639
01640
01641
01642
01643 template<bool cond_, typename true_type_, typename false_type_>
01644 struct type_if;
01645
01646 template<typename true_type_, typename false_type_>
01647 struct type_if<true, true_type_, false_type_>
01648 {
01649 typedef true_type_ type;
01650 };
01651
01652 template<typename true_type_, typename false_type_>
01653 struct type_if<false, true_type_, false_type_>
01654 {
01655 typedef false_type_ type;
01656 };
01657
01658 struct invalid_argument {};
01659
01660
01661
01662
01663
01664 template<typename left_type_, typename right_type_>
01665 struct same_type
01666 {
01667 static const bool result = false;
01668 };
01669
01670 template<typename type_>
01671 struct same_type<type_, type_>
01672 {
01673 static const bool result = true;
01674 };
01675
01676
01677
01678
01679
01680 template<typename type_>
01681 struct defined
01682 {
01683 static const bool value = true;
01684 };
01685
01686
01687
01688
01689
01690 template<bool cond_>
01691 struct compile_time_assert;
01692
01693 template<>
01694 struct compile_time_assert<true>
01695 {
01696 typedef void verified;
01697 };
01698
01699
01700
01701
01702
01703 template<typename type_, typename stencil_, typename other_>
01704 struct remove_4
01705 {
01706 typedef type_ type;
01707 typedef other_ other;
01708 };
01709
01710 template<typename type_, typename stencil_, typename other_>
01711 struct remove_4<volatile type_, volatile stencil_, other_>
01712 {
01713 typedef type_ type;
01714 typedef volatile other_ other;
01715 };
01716
01717
01718
01719 template<typename type_, typename stencil_, typename other_>
01720 struct remove_3
01721 {
01722 typedef typename remove_4<type_, stencil_, other_>::type type;
01723 typedef typename remove_4<type_, stencil_, other_>::other other;
01724 };
01725
01726 template<typename type_, typename stencil_, typename other_>
01727 struct remove_3<const type_, const stencil_, other_>
01728 {
01729 typedef typename remove_4<type_, stencil_, other_>::type type;
01730 typedef const typename remove_4<type_, stencil_, other_>::other other;
01731 };
01732
01733
01734
01735 template<typename type_, typename stencil_, typename other_>
01736 struct remove_2
01737 {
01738 typedef typename remove_3<type_, stencil_, other_>::type type;
01739 typedef typename remove_3<type_, stencil_, other_>::other other;
01740 };
01741
01742 template<typename type_, typename stencil_, typename other_>
01743 struct remove_2<type_*, stencil_*, other_>
01744 {
01745 typedef typename remove_3<type_, stencil_, other_>::type type;
01746 typedef typename remove_3<type_, stencil_, other_>::other* other;
01747 };
01748
01749
01750
01751 template<typename type_, typename stencil_, typename other_>
01752 struct remove_1
01753 {
01754 typedef typename remove_2<type_, stencil_, other_>::type type;
01755 typedef typename remove_2<type_, stencil_, other_>::other other;
01756 };
01757
01758 template<typename type_, typename stencil_, typename other_>
01759 struct remove_1<type_&, stencil_&, other_>
01760 {
01761 typedef typename remove_2<type_, stencil_, other_>::type type;
01762 typedef typename remove_2<type_, stencil_, other_>::other& other;
01763 };
01764
01765
01766
01767 template<typename type_, typename stencil_, typename other_=int>
01768 struct remove
01769 {
01770 typedef typename remove_1<type_, stencil_, other_>::type type;
01771 typedef typename remove_1<type_, stencil_, other_>::other other;
01772 };
01773
01774
01775
01776
01777
01778 template<typename dim_type_>
01779 struct dim_type_to_sig;
01780
01781 template<>
01782 struct dim_type_to_sig<int>
01783 { static const int n = 1; };
01784
01785 template<int n_>
01786 struct dim_type_to_sig<constant<int, n_> >
01787 { static const int n = n_; };
01788
01789 template<typename size_type_, typename value_type_>
01790 struct size_to_signature;
01791
01792
01793 template<
01794 typename value_type_>
01795 struct size_to_signature<pack<
01796 >,
01797 value_type_>
01798 {
01799 typedef value_type_ type
01800 ;
01801 };
01802
01803 template<
01804 typename type0_,
01805 typename value_type_>
01806 struct size_to_signature<pack<
01807 type0_
01808 >,
01809 value_type_>
01810 {
01811 typedef value_type_ type
01812 [dim_type_to_sig<type0_>::n]
01813 ;
01814 };
01815
01816 template<
01817 typename type0_,
01818 typename type1_,
01819 typename value_type_>
01820 struct size_to_signature<pack<
01821 type0_,
01822 type1_
01823 >,
01824 value_type_>
01825 {
01826 typedef value_type_ type
01827 [dim_type_to_sig<type0_>::n]
01828 [dim_type_to_sig<type1_>::n]
01829 ;
01830 };
01831
01832 template<
01833 typename type0_,
01834 typename type1_,
01835 typename type2_,
01836 typename value_type_>
01837 struct size_to_signature<pack<
01838 type0_,
01839 type1_,
01840 type2_
01841 >,
01842 value_type_>
01843 {
01844 typedef value_type_ type
01845 [dim_type_to_sig<type0_>::n]
01846 [dim_type_to_sig<type1_>::n]
01847 [dim_type_to_sig<type2_>::n]
01848 ;
01849 };
01850
01851 }
01852
01853
01854
01855
01856
01862 class size_mismatch_error
01863 : public std::runtime_error
01864 {
01865 public:
01866 size_mismatch_error(const std::string& msg ="")
01867 : std::runtime_error(msg)
01868 {}
01869
01870 ~size_mismatch_error() throw() {}
01871 };
01872
01873
01874
01875
01876
01891 template<typename type_, type_ value_>
01892 class constant
01893 {
01894 public:
01895 typedef type_ type;
01896 static const type_ value = value_;
01897 };
01898
01899 template<typename type_, type_ value_>
01900 const type_ constant<type_, value_>::value;
01901
01902 #ifdef DOCUMENTATION_ONLY
01903
01982 template<typename type0_ ..., typename typeN_>
01983 class pack
01984 {
01985 public:
01986 static const int n = N+1;
01987
01988 typedef ... typeX;
01989
01990 static const bool is_constX = ...;
01991
01992 static const bool is_all_const = ...;
01993
01994 static const typeX iX = valueX_;
01995
01996 typeX iX;
01997
01999 pack();
02000
02002 pack(const type0& a0);
02003
02005 pack(const type0& a0, ... , const typeN& aN);
02006
02008 template<typename other_type0_, ... , typename other_typeN_>
02009 pack(const pack<other_type0_, ... , other_typeN_>& other);
02010
02012 pack&
02013 operator= (const pack& other);
02014
02016 template<typename other_type0_, ... , typename other_typeN_>
02017 pack&
02018 operator= (const pack<other_type0_, ... , other_typeN_>& other);
02019
02021 void set(const type0& a0, ... , const typeN& aN);
02022 };
02023
02024 #else // DOCUMENTATION_ONLY
02025
02026 template<
02027 typename type0_,
02028 typename type1_,
02029 typename type2_,
02030 typename type3_
02031 >
02032 class pack
02033 {
02034 public:
02035 static const int n = 4;
02036
02037 typedef type0_ type0;
02038 typedef type1_ type1;
02039 typedef type2_ type2;
02040 typedef type3_ type3;
02041
02042 static const bool is_const0 = false;
02043 static const bool is_const1 = false;
02044 static const bool is_const2 = false;
02045 static const bool is_const3 = false;
02046 static const bool is_all_const = false;
02047 type0 i0;
02048 type1 i1;
02049 type2 i2;
02050 type3 i3;
02051
02052 LITE_INLINE pack()
02053 : i0(),i1(),i2(),i3() {}
02054
02055 LITE_INLINE pack(const type0& a0)
02056 : i0(a0)
02057 {}
02058
02059 LITE_INLINE pack(
02060 const type0& a0,
02061 const type1& a1,
02062 const type2& a2,
02063 const type3& a3
02064 ) : i0(a0), i1(a1), i2(a2), i3(a3) {}
02065
02066 template<
02067 typename other_type0_ ,
02068 typename other_type1_ ,
02069 typename other_type2_ ,
02070 typename other_type3_
02071 >
02072 LITE_INLINE pack(const pack<
02073 other_type0_,
02074 other_type1_,
02075 other_type2_,
02076 other_type3_
02077 >& other) : i0(other.i0), i1(other.i1), i2(other.i2), i3(other.i3) {}
02078
02079 LITE_INLINE pack&
02080 operator= (const pack& other)
02081 {
02082 i0 = other.i0;
02083 i1 = other.i1;
02084 i2 = other.i2;
02085 i3 = other.i3;
02086 return *this;
02087 }
02088
02089 template<
02090 typename other_type0_ ,
02091 typename other_type1_ ,
02092 typename other_type2_ ,
02093 typename other_type3_
02094 >
02095 LITE_INLINE pack&
02096 operator=(const pack<
02097 other_type0_,
02098 other_type1_,
02099 other_type2_,
02100 other_type3_
02101 >& other)
02102 {
02103 i0 = other.i0;
02104 i1 = other.i1;
02105 i2 = other.i2;
02106 i3 = other.i3;
02107 return *this;
02108 }
02109
02110 LITE_INLINE void set(
02111 const type0& a0,
02112 const type1& a1,
02113 const type2& a2,
02114 const type3& a3
02115 )
02116 {
02117 i0 = a0;
02118 i1 = a1;
02119 i2 = a2;
02120 i3 = a3;
02121 }
02122 };
02123
02124
02125
02126 template<
02127 typename type0_, type0_ value0_,
02128 typename type1_,
02129 typename type2_,
02130 typename type3_
02131 >
02132 class pack<
02133 constant<type0_, value0_>,
02134 type1_,
02135 type2_,
02136 type3_
02137 >
02138 {
02139 public:
02140 static const int n = 4;
02141
02142 typedef type0_ type0;
02143 typedef type1_ type1;
02144 typedef type2_ type2;
02145 typedef type3_ type3;
02146
02147 static const bool is_const0 = true;
02148 static const bool is_const1 = false;
02149 static const bool is_const2 = false;
02150 static const bool is_const3 = false;
02151 static const bool is_all_const = false;
02152 static const type0 i0 = value0_;
02153 type1 i1;
02154 type2 i2;
02155 type3 i3;
02156
02157 LITE_INLINE pack()
02158 : i1(),i2(),i3() {}
02159
02160 LITE_INLINE pack(const type0& )
02161 {}
02162
02163 LITE_INLINE pack(
02164 const type0& ,
02165 const type1& a1,
02166 const type2& a2,
02167 const type3& a3
02168 ) : i1(a1), i2(a2), i3(a3) {}
02169
02170 template<
02171 typename other_type0_ ,
02172 typename other_type1_ ,
02173 typename other_type2_ ,
02174 typename other_type3_
02175 >
02176 LITE_INLINE pack(const pack<
02177 other_type0_,
02178 other_type1_,
02179 other_type2_,
02180 other_type3_
02181 >& other) : i1(other.i1), i2(other.i2), i3(other.i3) {}
02182
02183 LITE_INLINE pack&
02184 operator= (const pack& other)
02185 {
02186 i1 = other.i1;
02187 i2 = other.i2;
02188 i3 = other.i3;
02189 return *this;
02190 }
02191
02192 template<
02193 typename other_type0_ ,
02194 typename other_type1_ ,
02195 typename other_type2_ ,
02196 typename other_type3_
02197 >
02198 LITE_INLINE pack&
02199 operator=(const pack<
02200 other_type0_,
02201 other_type1_,
02202 other_type2_,
02203 other_type3_
02204 >& other)
02205 {
02206 i1 = other.i1;
02207 i2 = other.i2;
02208 i3 = other.i3;
02209 return *this;
02210 }
02211
02212 LITE_INLINE void set(
02213 const type0& ,
02214 const type1& a1,
02215 const type2& a2,
02216 const type3& a3
02217 )
02218 {
02219 i1 = a1;
02220 i2 = a2;
02221 i3 = a3;
02222 }
02223 };
02224
02225
02226 template<
02227 typename type0_, type0_ value0_,
02228 typename type1_,
02229 typename type2_,
02230 typename type3_
02231 >
02232 const type0_ pack<
02233 constant<type0_, value0_>,
02234 type1_,
02235 type2_,
02236 type3_
02237 >::i0;
02238
02239
02240 template<
02241 typename type0_,
02242 typename type1_, type1_ value1_,
02243 typename type2_,
02244 typename type3_
02245 >
02246 class pack<
02247 type0_,
02248 constant<type1_, value1_>,
02249 type2_,
02250 type3_
02251 >
02252 {
02253 public:
02254 static const int n = 4;
02255
02256 typedef type0_ type0;
02257 typedef type1_ type1;
02258 typedef type2_ type2;
02259 typedef type3_ type3;
02260
02261 static const bool is_const0 = false;
02262 static const bool is_const1 = true;
02263 static const bool is_const2 = false;
02264 static const bool is_const3 = false;
02265 static const bool is_all_const = false;
02266 type0 i0;
02267 static const type1 i1 = value1_;
02268 type2 i2;
02269 type3 i3;
02270
02271 LITE_INLINE pack()
02272 : i0(),i2(),i3() {}
02273
02274 LITE_INLINE pack(const type0& a0)
02275 : i0(a0)
02276 {}
02277
02278 LITE_INLINE pack(
02279 const type0& a0,
02280 const type1& ,
02281 const type2& a2,
02282 const type3& a3
02283 ) : i0(a0), i2(a2), i3(a3) {}
02284
02285 template<
02286 typename other_type0_ ,
02287 typename other_type1_ ,
02288 typename other_type2_ ,
02289 typename other_type3_
02290 >
02291 LITE_INLINE pack(const pack<
02292 other_type0_,
02293 other_type1_,
02294 other_type2_,
02295 other_type3_
02296 >& other) : i0(other.i0), i2(other.i2), i3(other.i3) {}
02297
02298 LITE_INLINE pack&
02299 operator= (const pack& other)
02300 {
02301 i0 = other.i0;
02302 i2 = other.i2;
02303 i3 = other.i3;
02304 return *this;
02305 }
02306
02307 template<
02308 typename other_type0_ ,
02309 typename other_type1_ ,
02310 typename other_type2_ ,
02311 typename other_type3_
02312 >
02313 LITE_INLINE pack&
02314 operator=(const pack<
02315 other_type0_,
02316 other_type1_,
02317 other_type2_,
02318 other_type3_
02319 >& other)
02320 {
02321 i0 = other.i0;
02322 i2 = other.i2;
02323 i3 = other.i3;
02324 return *this;
02325 }
02326
02327 LITE_INLINE void set(
02328 const type0& a0,
02329 const type1& ,
02330 const type2& a2,
02331 const type3& a3
02332 )
02333 {
02334 i0 = a0;
02335 i2 = a2;
02336 i3 = a3;
02337 }
02338 };
02339
02340
02341 template<
02342 typename type0_,
02343 typename type1_, type1_ value1_,
02344 typename type2_,
02345 typename type3_
02346 >
02347 const type1_ pack<
02348 type0_,
02349 constant<type1_, value1_>,
02350 type2_,
02351 type3_
02352 >::i1;
02353
02354
02355 template<
02356 typename type0_, type0_ value0_,
02357 typename type1_, type1_ value1_,
02358 typename type2_,
02359 typename type3_
02360 >
02361 class pack<
02362 constant<type0_, value0_>,
02363 constant<type1_, value1_>,
02364 type2_,
02365 type3_
02366 >
02367 {
02368 public:
02369 static const int n = 4;
02370
02371 typedef type0_ type0;
02372 typedef type1_ type1;
02373 typedef type2_ type2;
02374 typedef type3_ type3;
02375
02376 static const bool is_const0 = true;
02377 static const bool is_const1 = true;
02378 static const bool is_const2 = false;
02379 static const bool is_const3 = false;
02380 static const bool is_all_const = false;
02381 static const type0 i0 = value0_;
02382 static const type1 i1 = value1_;
02383 type2 i2;
02384 type3 i3;
02385
02386 LITE_INLINE pack()
02387 : i2(),i3() {}
02388
02389 LITE_INLINE pack(const type0& )
02390 {}
02391
02392 LITE_INLINE pack(
02393 const type0& ,
02394 const type1& ,
02395 const type2& a2,
02396 const type3& a3
02397 ) : i2(a2), i3(a3) {}
02398
02399 template<
02400 typename other_type0_ ,
02401 typename other_type1_ ,
02402 typename other_type2_ ,
02403 typename other_type3_
02404 >
02405 LITE_INLINE pack(const pack<
02406 other_type0_,
02407 other_type1_,
02408 other_type2_,
02409 other_type3_
02410 >& other) : i2(other.i2), i3(other.i3) {}
02411
02412 LITE_INLINE pack&
02413 operator= (const pack& other)
02414 {
02415 i2 = other.i2;
02416 i3 = other.i3;
02417 return *this;
02418 }
02419
02420 template<
02421 typename other_type0_ ,
02422 typename other_type1_ ,
02423 typename other_type2_ ,
02424 typename other_type3_
02425 >
02426 LITE_INLINE pack&
02427 operator=(const pack<
02428 other_type0_,
02429 other_type1_,
02430 other_type2_,
02431 other_type3_
02432 >& other)
02433 {
02434 i2 = other.i2;
02435 i3 = other.i3;
02436 return *this;
02437 }
02438
02439 LITE_INLINE void set(
02440 const type0& ,
02441 const type1& ,
02442 const type2& a2,
02443 const type3& a3
02444 )
02445 {
02446 i2 = a2;
02447 i3 = a3;
02448 }
02449 };
02450
02451
02452 template<
02453 typename type0_, type0_ value0_,
02454 typename type1_, type1_ value1_,
02455 typename type2_,
02456 typename type3_
02457 >
02458 const type0_ pack<
02459 constant<type0_, value0_>,
02460 constant<type1_, value1_>,
02461 type2_,
02462 type3_
02463 >::i0;
02464
02465 template<
02466 typename type0_, type0_ value0_,
02467 typename type1_, type1_ value1_,
02468 typename type2_,
02469 typename type3_
02470 >
02471 const type1_ pack<
02472 constant<type0_, value0_>,
02473 constant<type1_, value1_>,
02474 type2_,
02475 type3_
02476 >::i1;
02477
02478
02479 template<
02480 typename type0_,
02481 typename type1_,
02482 typename type2_, type2_ value2_,
02483 typename type3_
02484 >
02485 class pack<
02486 type0_,
02487 type1_,
02488 constant<type2_, value2_>,
02489 type3_
02490 >
02491 {
02492 public:
02493 static const int n = 4;
02494
02495 typedef type0_ type0;
02496 typedef type1_ type1;
02497 typedef type2_ type2;
02498 typedef type3_ type3;
02499
02500 static const bool is_const0 = false;
02501 static const bool is_const1 = false;
02502 static const bool is_const2 = true;
02503 static const bool is_const3 = false;
02504 static const bool is_all_const = false;
02505 type0 i0;
02506 type1 i1;
02507 static const type2 i2 = value2_;
02508 type3 i3;
02509
02510 LITE_INLINE pack()
02511 : i0(),i1(),i3() {}
02512
02513 LITE_INLINE pack(const type0& a0)
02514 : i0(a0)
02515 {}
02516
02517 LITE_INLINE pack(
02518 const type0& a0,
02519 const type1& a1,
02520 const type2& ,
02521 const type3& a3
02522 ) : i0(a0), i1(a1), i3(a3) {}
02523
02524 template<
02525 typename other_type0_ ,
02526 typename other_type1_ ,
02527 typename other_type2_ ,
02528 typename other_type3_
02529 >
02530 LITE_INLINE pack(const pack<
02531 other_type0_,
02532 other_type1_,
02533 other_type2_,
02534 other_type3_
02535 >& other) : i0(other.i0), i1(other.i1), i3(other.i3) {}
02536
02537 LITE_INLINE pack&
02538 operator= (const pack& other)
02539 {
02540 i0 = other.i0;
02541 i1 = other.i1;
02542 i3 = other.i3;
02543 return *this;
02544 }
02545
02546 template<
02547 typename other_type0_ ,
02548 typename other_type1_ ,
02549 typename other_type2_ ,
02550 typename other_type3_
02551 >
02552 LITE_INLINE pack&
02553 operator=(const pack<
02554 other_type0_,
02555 other_type1_,
02556 other_type2_,
02557 other_type3_
02558 >& other)
02559 {
02560 i0 = other.i0;
02561 i1 = other.i1;
02562 i3 = other.i3;
02563 return *this;
02564 }
02565
02566 LITE_INLINE void set(
02567 const type0& a0,
02568 const type1& a1,
02569 const type2& ,
02570 const type3& a3
02571 )
02572 {
02573 i0 = a0;
02574 i1 = a1;
02575 i3 = a3;
02576 }
02577 };
02578
02579
02580 template<
02581 typename type0_,
02582 typename type1_,
02583 typename type2_, type2_ value2_,
02584 typename type3_
02585 >
02586 const type2_ pack<
02587 type0_,
02588 type1_,
02589 constant<type2_, value2_>,
02590 type3_
02591 >::i2;
02592
02593
02594 template<
02595 typename type0_, type0_ value0_,
02596 typename type1_,
02597 typename type2_, type2_ value2_,
02598 typename type3_
02599 >
02600 class pack<
02601 constant<type0_, value0_>,
02602 type1_,
02603 constant<type2_, value2_>,
02604 type3_
02605 >
02606 {
02607 public:
02608 static const int n = 4;
02609
02610 typedef type0_ type0;
02611 typedef type1_ type1;
02612 typedef type2_ type2;
02613 typedef type3_ type3;
02614
02615 static const bool is_const0 = true;
02616 static const bool is_const1 = false;
02617 static const bool is_const2 = true;
02618 static const bool is_const3 = false;
02619 static const bool is_all_const = false;
02620 static const type0 i0 = value0_;
02621 type1 i1;
02622 static const type2 i2 = value2_;
02623 type3 i3;
02624
02625 LITE_INLINE pack()
02626 : i1(),i3() {}
02627
02628 LITE_INLINE pack(const type0& )
02629 {}
02630
02631 LITE_INLINE pack(
02632 const type0& ,
02633 const type1& a1,
02634 const type2& ,
02635 const type3& a3
02636 ) : i1(a1), i3(a3) {}
02637
02638 template<
02639 typename other_type0_ ,
02640 typename other_type1_ ,
02641 typename other_type2_ ,
02642 typename other_type3_
02643 >
02644 LITE_INLINE pack(const pack<
02645 other_type0_,
02646 other_type1_,
02647 other_type2_,
02648 other_type3_
02649 >& other) : i1(other.i1), i3(other.i3) {}
02650
02651 LITE_INLINE pack&
02652 operator= (const pack& other)
02653 {
02654 i1 = other.i1;
02655 i3 = other.i3;
02656 return *this;
02657 }
02658
02659 template<
02660 typename other_type0_ ,
02661 typename other_type1_ ,
02662 typename other_type2_ ,
02663 typename other_type3_
02664 >
02665 LITE_INLINE pack&
02666 operator=(const pack<
02667 other_type0_,
02668 other_type1_,
02669 other_type2_,
02670 other_type3_
02671 >& other)
02672 {
02673 i1 = other.i1;
02674 i3 = other.i3;
02675 return *this;
02676 }
02677
02678 LITE_INLINE void set(
02679 const type0& ,
02680 const type1& a1,
02681 const type2& ,
02682 const type3& a3
02683 )
02684 {
02685 i1 = a1;
02686 i3 = a3;
02687 }
02688 };
02689
02690
02691 template<
02692 typename type0_, type0_ value0_,
02693 typename type1_,
02694 typename type2_, type2_ value2_,
02695 typename type3_
02696 >
02697 const type0_ pack<
02698 constant<type0_, value0_>,
02699 type1_,
02700 constant<type2_, value2_>,
02701 type3_
02702 >::i0;
02703
02704 template<
02705 typename type0_, type0_ value0_,
02706 typename type1_,
02707 typename type2_, type2_ value2_,
02708 typename type3_
02709 >
02710 const type2_ pack<
02711 constant<type0_, value0_>,
02712 type1_,
02713 constant<type2_, value2_>,
02714 type3_
02715 >::i2;
02716
02717
02718 template<
02719 typename type0_,
02720 typename type1_, type1_ value1_,
02721 typename type2_, type2_ value2_,
02722 typename type3_
02723 >
02724 class pack<
02725 type0_,
02726 constant<type1_, value1_>,
02727 constant<type2_, value2_>,
02728 type3_
02729 >
02730 {
02731 public:
02732 static const int n = 4;
02733
02734 typedef type0_ type0;
02735 typedef type1_ type1;
02736 typedef type2_ type2;
02737 typedef type3_ type3;
02738
02739 static const bool is_const0 = false;
02740 static const bool is_const1 = true;
02741 static const bool is_const2 = true;
02742 static const bool is_const3 = false;
02743 static const bool is_all_const = false;
02744 type0 i0;
02745 static const type1 i1 = value1_;
02746 static const type2 i2 = value2_;
02747 type3 i3;
02748
02749 LITE_INLINE pack()
02750 : i0(),i3() {}
02751
02752 LITE_INLINE pack(const type0& a0)
02753 : i0(a0)
02754 {}
02755
02756 LITE_INLINE pack(
02757 const type0& a0,
02758 const type1& ,
02759 const type2& ,
02760 const type3& a3
02761 ) : i0(a0), i3(a3) {}
02762
02763 template<
02764 typename other_type0_ ,
02765 typename other_type1_ ,
02766 typename other_type2_ ,
02767 typename other_type3_
02768 >
02769 LITE_INLINE pack(const pack<
02770 other_type0_,
02771 other_type1_,
02772 other_type2_,
02773 other_type3_
02774 >& other) : i0(other.i0), i3(other.i3) {}
02775
02776 LITE_INLINE pack&
02777 operator= (const pack& other)
02778 {
02779 i0 = other.i0;
02780 i3 = other.i3;
02781 return *this;
02782 }
02783
02784 template<
02785 typename other_type0_ ,
02786 typename other_type1_ ,
02787 typename other_type2_ ,
02788 typename other_type3_
02789 >
02790 LITE_INLINE pack&
02791 operator=(const pack<
02792 other_type0_,
02793 other_type1_,
02794 other_type2_,
02795 other_type3_
02796 >& other)
02797 {
02798 i0 = other.i0;
02799 i3 = other.i3;
02800 return *this;
02801 }
02802
02803 LITE_INLINE void set(
02804 const type0& a0,
02805 const type1& ,
02806 const type2& ,
02807 const type3& a3
02808 )
02809 {
02810 i0 = a0;
02811 i3 = a3;
02812 }
02813 };
02814
02815
02816 template<
02817 typename type0_,
02818 typename type1_, type1_ value1_,
02819 typename type2_, type2_ value2_,
02820 typename type3_
02821 >
02822 const type1_ pack<
02823 type0_,
02824 constant<type1_, value1_>,
02825 constant<type2_, value2_>,
02826 type3_
02827 >::i1;
02828
02829 template<
02830 typename type0_,
02831 typename type1_, type1_ value1_,
02832 typename type2_, type2_ value2_,
02833 typename type3_
02834 >
02835 const type2_ pack<
02836 type0_,
02837 constant<type1_, value1_>,
02838 constant<type2_, value2_>,
02839 type3_
02840 >::i2;
02841
02842
02843 template<
02844 typename type0_, type0_ value0_,
02845 typename type1_, type1_ value1_,
02846 typename type2_, type2_ value2_,
02847 typename type3_
02848 >
02849 class pack<
02850 constant<type0_, value0_>,
02851 constant<type1_, value1_>,
02852 constant<type2_, value2_>,
02853 type3_
02854 >
02855 {
02856 public:
02857 static const int n = 4;
02858
02859 typedef type0_ type0;
02860 typedef type1_ type1;
02861 typedef type2_ type2;
02862 typedef type3_ type3;
02863
02864 static const bool is_const0 = true;
02865 static const bool is_const1 = true;
02866 static const bool is_const2 = true;
02867 static const bool is_const3 = false;
02868 static const bool is_all_const = false;
02869 static const type0 i0 = value0_;
02870 static const type1 i1 = value1_;
02871 static const type2 i2 = value2_;
02872 type3 i3;
02873
02874 LITE_INLINE pack()
02875 : i3() {}
02876
02877 LITE_INLINE pack(const type0& )
02878 {}
02879
02880 LITE_INLINE pack(
02881 const type0& ,
02882 const type1& ,
02883 const type2& ,
02884 const type3& a3
02885 ) : i3(a3) {}
02886
02887 template<
02888 typename other_type0_ ,
02889 typename other_type1_ ,
02890 typename other_type2_ ,
02891 typename other_type3_
02892 >
02893 LITE_INLINE pack(const pack<
02894 other_type0_,
02895 other_type1_,
02896 other_type2_,
02897 other_type3_
02898 >& other) : i3(other.i3) {}
02899
02900 LITE_INLINE pack&
02901 operator= (const pack& other)
02902 {
02903 i3 = other.i3;
02904 return *this;
02905 }
02906
02907 template<
02908 typename other_type0_ ,
02909 typename other_type1_ ,
02910 typename other_type2_ ,
02911 typename other_type3_
02912 >
02913 LITE_INLINE pack&
02914 operator=(const pack<
02915 other_type0_,
02916 other_type1_,
02917 other_type2_,
02918 other_type3_
02919 >& other)
02920 {
02921 i3 = other.i3;
02922 return *this;
02923 }
02924
02925 LITE_INLINE void set(
02926 const type0& ,
02927 const type1& ,
02928 const type2& ,
02929 const type3& a3
02930 )
02931 {
02932 i3 = a3;
02933 }
02934 };
02935
02936
02937 template<
02938 typename type0_, type0_ value0_,
02939 typename type1_, type1_ value1_,
02940 typename type2_, type2_ value2_,
02941 typename type3_
02942 >
02943 const type0_ pack<
02944 constant<type0_, value0_>,
02945 constant<type1_, value1_>,
02946 constant<type2_, value2_>,
02947 type3_
02948 >::i0;
02949
02950 template<
02951 typename type0_, type0_ value0_,
02952 typename type1_, type1_ value1_,
02953 typename type2_, type2_ value2_,
02954 typename type3_
02955 >
02956 const type1_ pack<
02957 constant<type0_, value0_>,
02958 constant<type1_, value1_>,
02959 constant<type2_, value2_>,
02960 type3_
02961 >::i1;
02962
02963 template<
02964 typename type0_, type0_ value0_,
02965 typename type1_, type1_ value1_,
02966 typename type2_, type2_ value2_,
02967 typename type3_
02968 >
02969 const type2_ pack<
02970 constant<type0_, value0_>,
02971 constant<type1_, value1_>,
02972 constant<type2_, value2_>,
02973 type3_
02974 >::i2;
02975
02976
02977 template<
02978 typename type0_,
02979 typename type1_,
02980 typename type2_,
02981 typename type3_, type3_ value3_
02982 >
02983 class pack<
02984 type0_,
02985 type1_,
02986 type2_,
02987 constant<type3_, value3_>
02988 >
02989 {
02990 public:
02991 static const int n = 4;
02992
02993 typedef type0_ type0;
02994 typedef type1_ type1;
02995 typedef type2_ type2;
02996 typedef type3_ type3;
02997
02998 static const bool is_const0 = false;
02999 static const bool is_const1 = false;
03000 static const bool is_const2 = false;
03001 static const bool is_const3 = true;
03002 static const bool is_all_const = false;
03003 type0 i0;
03004 type1 i1;
03005 type2 i2;
03006 static const type3 i3 = value3_;
03007
03008 LITE_INLINE pack()
03009 : i0(),i1(),i2() {}
03010
03011 LITE_INLINE pack(const type0& a0)
03012 : i0(a0)
03013 {}
03014
03015 LITE_INLINE pack(
03016 const type0& a0,
03017 const type1& a1,
03018 const type2& a2,
03019 const type3&
03020 ) : i0(a0), i1(a1), i2(a2) {}
03021
03022 template<
03023 typename other_type0_ ,
03024 typename other_type1_ ,
03025 typename other_type2_ ,
03026 typename other_type3_
03027 >
03028 LITE_INLINE pack(const pack<
03029 other_type0_,
03030 other_type1_,
03031 other_type2_,
03032 other_type3_
03033 >& other) : i0(other.i0), i1(other.i1), i2(other.i2) {}
03034
03035 LITE_INLINE pack&
03036 operator= (const pack& other)
03037 {
03038 i0 = other.i0;
03039 i1 = other.i1;
03040 i2 = other.i2;
03041 return *this;
03042 }
03043
03044 template<
03045 typename other_type0_ ,
03046 typename other_type1_ ,
03047 typename other_type2_ ,
03048 typename other_type3_
03049 >
03050 LITE_INLINE pack&
03051 operator=(const pack<
03052 other_type0_,
03053 other_type1_,
03054 other_type2_,
03055 other_type3_
03056 >& other)
03057 {
03058 i0 = other.i0;
03059 i1 = other.i1;
03060 i2 = other.i2;
03061 return *this;
03062 }
03063
03064 LITE_INLINE void set(
03065 const type0& a0,
03066 const type1& a1,
03067 const type2& a2,
03068 const type3&
03069 )
03070 {
03071 i0 = a0;
03072 i1 = a1;
03073 i2 = a2;
03074 }
03075 };
03076
03077
03078 template<
03079 typename type0_,
03080 typename type1_,
03081 typename type2_,
03082 typename type3_, type3_ value3_
03083 >
03084 const type3_ pack<
03085 type0_,
03086 type1_,
03087 type2_,
03088 constant<type3_, value3_>
03089 >::i3;
03090
03091
03092 template<
03093 typename type0_, type0_ value0_,
03094 typename type1_,
03095 typename type2_,
03096 typename type3_, type3_ value3_
03097 >
03098 class pack<
03099 constant<type0_, value0_>,
03100 type1_,
03101 type2_,
03102 constant<type3_, value3_>
03103 >
03104 {
03105 public:
03106 static const int n = 4;
03107
03108 typedef type0_ type0;
03109 typedef type1_ type1;
03110 typedef type2_ type2;
03111 typedef type3_ type3;
03112
03113 static const bool is_const0 = true;
03114 static const bool is_const1 = false;
03115 static const bool is_const2 = false;
03116 static const bool is_const3 = true;
03117 static const bool is_all_const = false;
03118 static const type0 i0 = value0_;
03119 type1 i1;
03120 type2 i2;
03121 static const type3 i3 = value3_;
03122
03123 LITE_INLINE pack()
03124 : i1(),i2() {}
03125
03126 LITE_INLINE pack(const type0& )
03127 {}
03128
03129 LITE_INLINE pack(
03130 const type0& ,
03131 const type1& a1,
03132 const type2& a2,
03133 const type3&
03134 ) : i1(a1), i2(a2) {}
03135
03136 template<
03137 typename other_type0_ ,
03138 typename other_type1_ ,
03139 typename other_type2_ ,
03140 typename other_type3_
03141 >
03142 LITE_INLINE pack(const pack<
03143 other_type0_,
03144 other_type1_,
03145 other_type2_,
03146 other_type3_
03147 >& other) : i1(other.i1), i2(other.i2) {}
03148
03149 LITE_INLINE pack&
03150 operator= (const pack& other)
03151 {
03152 i1 = other.i1;
03153 i2 = other.i2;
03154 return *this;
03155 }
03156
03157 template<
03158 typename other_type0_ ,
03159 typename other_type1_ ,
03160 typename other_type2_ ,
03161 typename other_type3_
03162 >
03163 LITE_INLINE pack&
03164 operator=(const pack<
03165 other_type0_,
03166 other_type1_,
03167 other_type2_,
03168 other_type3_
03169 >& other)
03170 {
03171 i1 = other.i1;
03172 i2 = other.i2;
03173 return *this;
03174 }
03175
03176 LITE_INLINE void set(
03177 const type0& ,
03178 const type1& a1,
03179 const type2& a2,
03180 const type3&
03181 )
03182 {
03183 i1 = a1;
03184 i2 = a2;
03185 }
03186 };
03187
03188
03189 template<
03190 typename type0_, type0_ value0_,
03191 typename type1_,
03192 typename type2_,
03193 typename type3_, type3_ value3_
03194 >
03195 const type0_ pack<
03196 constant<type0_, value0_>,
03197 type1_,
03198 type2_,
03199 constant<type3_, value3_>
03200 >::i0;
03201
03202 template<
03203 typename type0_, type0_ value0_,
03204 typename type1_,
03205 typename type2_,
03206 typename type3_, type3_ value3_
03207 >
03208 const type3_ pack<
03209 constant<type0_, value0_>,
03210 type1_,
03211 type2_,
03212 constant<type3_, value3_>
03213 >::i3;
03214
03215
03216 template<
03217 typename type0_,
03218 typename type1_, type1_ value1_,
03219 typename type2_,
03220 typename type3_, type3_ value3_
03221 >
03222 class pack<
03223 type0_,
03224 constant<type1_, value1_>,
03225 type2_,
03226 constant<type3_, value3_>
03227 >
03228 {
03229 public:
03230 static const int n = 4;
03231
03232 typedef type0_ type0;
03233 typedef type1_ type1;
03234 typedef type2_ type2;
03235 typedef type3_ type3;
03236
03237 static const bool is_const0 = false;
03238 static const bool is_const1 = true;
03239 static const bool is_const2 = false;
03240 static const bool is_const3 = true;
03241 static const bool is_all_const = false;
03242 type0 i0;
03243 static const type1 i1 = value1_;
03244 type2 i2;
03245 static const type3 i3 = value3_;
03246
03247 LITE_INLINE pack()
03248 : i0(),i2() {}
03249
03250 LITE_INLINE pack(const type0& a0)
03251 : i0(a0)
03252 {}
03253
03254 LITE_INLINE pack(
03255 const type0& a0,
03256 const type1& ,
03257 const type2& a2,
03258 const type3&
03259 ) : i0(a0), i2(a2) {}
03260
03261 template<
03262 typename other_type0_ ,
03263 typename other_type1_ ,
03264 typename other_type2_ ,
03265 typename other_type3_
03266 >
03267 LITE_INLINE pack(const pack<
03268 other_type0_,
03269 other_type1_,
03270 other_type2_,
03271 other_type3_
03272 >& other) : i0(other.i0), i2(other.i2) {}
03273
03274 LITE_INLINE pack&
03275 operator= (const pack& other)
03276 {
03277 i0 = other.i0;
03278 i2 = other.i2;
03279 return *this;
03280 }
03281
03282 template<
03283 typename other_type0_ ,
03284 typename other_type1_ ,
03285 typename other_type2_ ,
03286 typename other_type3_
03287 >
03288 LITE_INLINE pack&
03289 operator=(const pack<
03290 other_type0_,
03291 other_type1_,
03292 other_type2_,
03293 other_type3_
03294 >& other)
03295 {
03296 i0 = other.i0;
03297 i2 = other.i2;
03298 return *this;
03299 }
03300
03301 LITE_INLINE void set(
03302 const type0& a0,
03303 const type1& ,
03304 const type2& a2,
03305 const type3&
03306 )
03307 {
03308 i0 = a0;
03309 i2 = a2;
03310 }
03311 };
03312
03313
03314 template<
03315 typename type0_,
03316 typename type1_, type1_ value1_,
03317 typename type2_,
03318 typename type3_, type3_ value3_
03319 >
03320 const type1_ pack<
03321 type0_,
03322 constant<type1_, value1_>,
03323 type2_,
03324 constant<type3_, value3_>
03325 >::i1;
03326
03327 template<
03328 typename type0_,
03329 typename type1_, type1_ value1_,
03330 typename type2_,
03331 typename type3_, type3_ value3_
03332 >
03333 const type3_ pack<
03334 type0_,
03335 constant<type1_, value1_>,
03336 type2_,
03337 constant<type3_, value3_>
03338 >::i3;
03339
03340
03341 template<
03342 typename type0_, type0_ value0_,
03343 typename type1_, type1_ value1_,
03344 typename type2_,
03345 typename type3_, type3_ value3_
03346 >
03347 class pack<
03348 constant<type0_, value0_>,
03349 constant<type1_, value1_>,
03350 type2_,
03351 constant<type3_, value3_>
03352 >
03353 {
03354 public:
03355 static const int n = 4;
03356
03357 typedef type0_ type0;
03358 typedef type1_ type1;
03359 typedef type2_ type2;
03360 typedef type3_ type3;
03361
03362 static const bool is_const0 = true;
03363 static const bool is_const1 = true;
03364 static const bool is_const2 = false;
03365 static const bool is_const3 = true;
03366 static const bool is_all_const = false;
03367 static const type0 i0 = value0_;
03368 static const type1 i1 = value1_;
03369 type2 i2;
03370 static const type3 i3 = value3_;
03371
03372 LITE_INLINE pack()
03373 : i2() {}
03374
03375 LITE_INLINE pack(const type0& )
03376 {}
03377
03378 LITE_INLINE pack(
03379 const type0& ,
03380 const type1& ,
03381 const type2& a2,
03382 const type3&
03383 ) : i2(a2) {}
03384
03385 template<
03386 typename other_type0_ ,
03387 typename other_type1_ ,
03388 typename other_type2_ ,
03389 typename other_type3_
03390 >
03391 LITE_INLINE pack(const pack<
03392 other_type0_,
03393 other_type1_,
03394 other_type2_,
03395 other_type3_
03396 >& other) : i2(other.i2) {}
03397
03398 LITE_INLINE pack&
03399 operator= (const pack& other)
03400 {
03401 i2 = other.i2;
03402 return *this;
03403 }
03404
03405 template<
03406 typename other_type0_ ,
03407 typename other_type1_ ,
03408 typename other_type2_ ,
03409 typename other_type3_
03410 >
03411 LITE_INLINE pack&
03412 operator=(const pack<
03413 other_type0_,
03414 other_type1_,
03415 other_type2_,
03416 other_type3_
03417 >& other)
03418 {
03419 i2 = other.i2;
03420 return *this;
03421 }
03422
03423 LITE_INLINE void set(
03424 const type0& ,
03425 const type1& ,
03426 const type2& a2,
03427 const type3&
03428 )
03429 {
03430 i2 = a2;
03431 }
03432 };
03433
03434
03435 template<
03436 typename type0_, type0_ value0_,
03437 typename type1_, type1_ value1_,
03438 typename type2_,
03439 typename type3_, type3_ value3_
03440 >
03441 const type0_ pack<
03442 constant<type0_, value0_>,
03443 constant<type1_, value1_>,
03444 type2_,
03445 constant<type3_, value3_>
03446 >::i0;
03447
03448 template<
03449 typename type0_, type0_ value0_,
03450 typename type1_, type1_ value1_,
03451 typename type2_,
03452 typename type3_, type3_ value3_
03453 >
03454 const type1_ pack<
03455 constant<type0_, value0_>,
03456 constant<type1_, value1_>,
03457 type2_,
03458 constant<type3_, value3_>
03459 >::i1;
03460
03461 template<
03462 typename type0_, type0_ value0_,
03463 typename type1_, type1_ value1_,
03464 typename type2_,
03465 typename type3_, type3_ value3_
03466 >
03467 const type3_ pack<
03468 constant<type0_, value0_>,
03469 constant<type1_, value1_>,
03470 type2_,
03471 constant<type3_, value3_>
03472 >::i3;
03473
03474
03475 template<
03476 typename type0_,
03477 typename type1_,
03478 typename type2_, type2_ value2_,
03479 typename type3_, type3_ value3_
03480 >
03481 class pack<
03482 type0_,
03483 type1_,
03484 constant<type2_, value2_>,
03485 constant<type3_, value3_>
03486 >
03487 {
03488 public:
03489 static const int n = 4;
03490
03491 typedef type0_ type0;
03492 typedef type1_ type1;
03493 typedef type2_ type2;
03494 typedef type3_ type3;
03495
03496 static const bool is_const0 = false;
03497 static const bool is_const1 = false;
03498 static const bool is_const2 = true;
03499 static const bool is_const3 = true;
03500 static const bool is_all_const = false;
03501 type0 i0;
03502 type1 i1;
03503 static const type2 i2 = value2_;
03504 static const type3 i3 = value3_;
03505
03506 LITE_INLINE pack()
03507 : i0(),i1() {}
03508
03509 LITE_INLINE pack(const type0& a0)
03510 : i0(a0)
03511 {}
03512
03513 LITE_INLINE pack(
03514 const type0& a0,
03515 const type1& a1,
03516 const type2& ,
03517 const type3&
03518 ) : i0(a0), i1(a1) {}
03519
03520 template<
03521 typename other_type0_ ,
03522 typename other_type1_ ,
03523 typename other_type2_ ,
03524 typename other_type3_
03525 >
03526 LITE_INLINE pack(const pack<
03527 other_type0_,
03528 other_type1_,
03529 other_type2_,
03530 other_type3_
03531 >& other) : i0(other.i0), i1(other.i1) {}
03532
03533 LITE_INLINE pack&
03534 operator= (const pack& other)
03535 {
03536 i0 = other.i0;
03537 i1 = other.i1;
03538 return *this;
03539 }
03540
03541 template<
03542 typename other_type0_ ,
03543 typename other_type1_ ,
03544 typename other_type2_ ,
03545 typename other_type3_
03546 >
03547 LITE_INLINE pack&
03548 operator=(const pack<
03549 other_type0_,
03550 other_type1_,
03551 other_type2_,
03552 other_type3_
03553 >& other)
03554 {
03555 i0 = other.i0;
03556 i1 = other.i1;
03557 return *this;
03558 }
03559
03560 LITE_INLINE void set(
03561 const type0& a0,
03562 const type1& a1,
03563 const type2& ,
03564 const type3&
03565 )
03566 {
03567 i0 = a0;
03568 i1 = a1;
03569 }
03570 };
03571
03572
03573 template<
03574 typename type0_,
03575 typename type1_,
03576 typename type2_, type2_ value2_,
03577 typename type3_, type3_ value3_
03578 >
03579 const type2_ pack<
03580 type0_,
03581 type1_,
03582 constant<type2_, value2_>,
03583 constant<type3_, value3_>
03584 >::i2;
03585
03586 template<
03587 typename type0_,
03588 typename type1_,
03589 typename type2_, type2_ value2_,
03590 typename type3_, type3_ value3_
03591 >
03592 const type3_ pack<
03593 type0_,
03594 type1_,
03595 constant<type2_, value2_>,
03596 constant<type3_, value3_>
03597 >::i3;
03598
03599
03600 template<
03601 typename type0_, type0_ value0_,
03602 typename type1_,
03603 typename type2_, type2_ value2_,
03604 typename type3_, type3_ value3_
03605 >
03606 class pack<
03607 constant<type0_, value0_>,
03608 type1_,
03609 constant<type2_, value2_>,
03610 constant<type3_, value3_>
03611 >
03612 {
03613 public:
03614 static const int n = 4;
03615
03616 typedef type0_ type0;
03617 typedef type1_ type1;
03618 typedef type2_ type2;
03619 typedef type3_ type3;
03620
03621 static const bool is_const0 = true;
03622 static const bool is_const1 = false;
03623 static const bool is_const2 = true;
03624 static const bool is_const3 = true;
03625 static const bool is_all_const = false;
03626 static const type0 i0 = value0_;
03627 type1 i1;
03628 static const type2 i2 = value2_;
03629 static const type3 i3 = value3_;
03630
03631 LITE_INLINE pack()
03632 : i1() {}
03633
03634 LITE_INLINE pack(const type0& )
03635 {}
03636
03637 LITE_INLINE pack(
03638 const type0& ,
03639 const type1& a1,
03640 const type2& ,
03641 const type3&
03642 ) : i1(a1) {}
03643
03644 template<
03645 typename other_type0_ ,
03646 typename other_type1_ ,
03647 typename other_type2_ ,
03648 typename other_type3_
03649 >
03650 LITE_INLINE pack(const pack<
03651 other_type0_,
03652 other_type1_,
03653 other_type2_,
03654 other_type3_
03655 >& other) : i1(other.i1) {}
03656
03657 LITE_INLINE pack&
03658 operator= (const pack& other)
03659 {
03660 i1 = other.i1;
03661 return *this;
03662 }
03663
03664 template<
03665 typename other_type0_ ,
03666 typename other_type1_ ,
03667 typename other_type2_ ,
03668 typename other_type3_
03669 >
03670 LITE_INLINE pack&
03671 operator=(const pack<
03672 other_type0_,
03673 other_type1_,
03674 other_type2_,
03675 other_type3_
03676 >& other)
03677 {
03678 i1 = other.i1;
03679 return *this;
03680 }
03681
03682 LITE_INLINE void set(
03683 const type0& ,
03684 const type1& a1,
03685 const type2& ,
03686 const type3&
03687 )
03688 {
03689 i1 = a1;
03690 }
03691 };
03692
03693
03694 template<
03695 typename type0_, type0_ value0_,
03696 typename type1_,
03697 typename type2_, type2_ value2_,
03698 typename type3_, type3_ value3_
03699 >
03700 const type0_ pack<
03701 constant<type0_, value0_>,
03702 type1_,
03703 constant<type2_, value2_>,
03704 constant<type3_, value3_>
03705 >::i0;
03706
03707 template<
03708 typename type0_, type0_ value0_,
03709 typename type1_,
03710 typename type2_, type2_ value2_,
03711 typename type3_, type3_ value3_
03712 >
03713 const type2_ pack<
03714 constant<type0_, value0_>,
03715 type1_,
03716 constant<type2_, value2_>,
03717 constant<type3_, value3_>
03718 >::i2;
03719
03720 template<
03721 typename type0_, type0_ value0_,
03722 typename type1_,
03723 typename type2_, type2_ value2_,
03724 typename type3_, type3_ value3_
03725 >
03726 const type3_ pack<
03727 constant<type0_, value0_>,
03728 type1_,
03729 constant<type2_, value2_>,
03730 constant<type3_, value3_>
03731 >::i3;
03732
03733
03734 template<
03735 typename type0_,
03736 typename type1_, type1_ value1_,
03737 typename type2_, type2_ value2_,
03738 typename type3_, type3_ value3_
03739 >
03740 class pack<
03741 type0_,
03742 constant<type1_, value1_>,
03743 constant<type2_, value2_>,
03744 constant<type3_, value3_>
03745 >
03746 {
03747 public:
03748 static const int n = 4;
03749
03750 typedef type0_ type0;
03751 typedef type1_ type1;
03752 typedef type2_ type2;
03753 typedef type3_ type3;
03754
03755 static const bool is_const0 = false;
03756 static const bool is_const1 = true;
03757 static const bool is_const2 = true;
03758 static const bool is_const3 = true;
03759 static const bool is_all_const = false;
03760 type0 i0;
03761 static const type1 i1 = value1_;
03762 static const type2 i2 = value2_;
03763 static const type3 i3 = value3_;
03764
03765 LITE_INLINE pack()
03766 : i0() {}
03767
03768 LITE_INLINE pack(const type0& a0)
03769 : i0(a0)
03770 {}
03771
03772 LITE_INLINE pack(
03773 const type0& a0,
03774 const type1& ,
03775 const type2& ,
03776 const type3&
03777 ) : i0(a0) {}
03778
03779 template<
03780 typename other_type0_ ,
03781 typename other_type1_ ,
03782 typename other_type2_ ,
03783 typename other_type3_
03784 >
03785 LITE_INLINE pack(const pack<
03786 other_type0_,
03787 other_type1_,
03788 other_type2_,
03789 other_type3_
03790 >& other) : i0(other.i0) {}
03791
03792 LITE_INLINE pack&
03793 operator= (const pack& other)
03794 {
03795 i0 = other.i0;
03796 return *this;
03797 }
03798
03799 template<
03800 typename other_type0_ ,
03801 typename other_type1_ ,
03802 typename other_type2_ ,
03803 typename other_type3_
03804 >
03805 LITE_INLINE pack&
03806 operator=(const pack<
03807 other_type0_,
03808 other_type1_,
03809 other_type2_,
03810 other_type3_
03811 >& other)
03812 {
03813 i0 = other.i0;
03814 return *this;
03815 }
03816
03817 LITE_INLINE void set(
03818 const type0& a0,
03819 const type1& ,
03820 const type2& ,
03821 const type3&
03822 )
03823 {
03824 i0 = a0;
03825 }
03826 };
03827
03828
03829 template<
03830 typename type0_,
03831 typename type1_, type1_ value1_,
03832 typename type2_, type2_ value2_,
03833 typename type3_, type3_ value3_
03834 >
03835 const type1_ pack<
03836 type0_,
03837 constant<type1_, value1_>,
03838 constant<type2_, value2_>,
03839 constant<type3_, value3_>
03840 >::i1;
03841
03842 template<
03843 typename type0_,
03844 typename type1_, type1_ value1_,
03845 typename type2_, type2_ value2_,
03846 typename type3_, type3_ value3_
03847 >
03848 const type2_ pack<
03849 type0_,
03850 constant<type1_, value1_>,
03851 constant<type2_, value2_>,
03852 constant<type3_, value3_>
03853 >::i2;
03854
03855 template<
03856 typename type0_,
03857 typename type1_, type1_ value1_,
03858 typename type2_, type2_ value2_,
03859 typename type3_, type3_ value3_
03860 >
03861 const type3_ pack<
03862 type0_,
03863 constant<type1_, value1_>,
03864 constant<type2_, value2_>,
03865 constant<type3_, value3_>
03866 >::i3;
03867
03868
03869 template<
03870 typename type0_, type0_ value0_,
03871 typename type1_, type1_ value1_,
03872 typename type2_, type2_ value2_,
03873 typename type3_, type3_ value3_
03874 >
03875 class pack<
03876 constant<type0_, value0_>,
03877 constant<type1_, value1_>,
03878 constant<type2_, value2_>,
03879 constant<type3_, value3_>
03880 >
03881 {
03882 public:
03883 static const int n = 4;
03884
03885 typedef type0_ type0;
03886 typedef type1_ type1;
03887 typedef type2_ type2;
03888 typedef type3_ type3;
03889
03890 static const bool is_const0 = true;
03891 static const bool is_const1 = true;
03892 static const bool is_const2 = true;
03893 static const bool is_const3 = true;
03894 static const bool is_all_const = true;
03895 static const type0 i0 = value0_;
03896 static const type1 i1 = value1_;
03897 static const type2 i2 = value2_;
03898 static const type3 i3 = value3_;
03899
03900 LITE_INLINE pack()
03901 {}
03902
03903 LITE_INLINE pack(const type0& )
03904 {}
03905
03906 LITE_INLINE pack(
03907 const type0& ,
03908 const type1& ,
03909 const type2& ,
03910 const type3&
03911 ) {}
03912
03913 template<
03914 typename other_type0_ ,
03915 typename other_type1_ ,
03916 typename other_type2_ ,
03917 typename other_type3_
03918 >
03919 LITE_INLINE pack(const pack<
03920 other_type0_,
03921 other_type1_,
03922 other_type2_,
03923 other_type3_
03924 >& ) {}
03925
03926 LITE_INLINE pack&
03927 operator= (const pack& )
03928 {
03929 return *this;
03930 }
03931
03932 template<
03933 typename other_type0_ ,
03934 typename other_type1_ ,
03935 typename other_type2_ ,
03936 typename other_type3_
03937 >
03938 LITE_INLINE pack&
03939 operator=(const pack<
03940 other_type0_,
03941 other_type1_,
03942 other_type2_,
03943 other_type3_
03944 >& )
03945 {
03946 return *this;
03947 }
03948
03949 LITE_INLINE void set(
03950 const type0& ,
03951 const type1& ,
03952 const type2& ,
03953 const type3&
03954 )
03955 {
03956 }
03957 };
03958
03959
03960 template<
03961 typename type0_, type0_ value0_,
03962 typename type1_, type1_ value1_,
03963 typename type2_, type2_ value2_,
03964 typename type3_, type3_ value3_
03965 >
03966 const type0_ pack<
03967 constant<type0_, value0_>,
03968 constant<type1_, value1_>,
03969 constant<type2_, value2_>,
03970 constant<type3_, value3_>
03971 >::i0;
03972
03973 template<
03974 typename type0_, type0_ value0_,
03975 typename type1_, type1_ value1_,
03976 typename type2_, type2_ value2_,
03977 typename type3_, type3_ value3_
03978 >
03979 const type1_ pack<
03980 constant<type0_, value0_>,
03981 constant<type1_, value1_>,
03982 constant<type2_, value2_>,
03983 constant<type3_, value3_>
03984 >::i1;
03985
03986 template<
03987 typename type0_, type0_ value0_,
03988 typename type1_, type1_ value1_,
03989 typename type2_, type2_ value2_,
03990 typename type3_, type3_ value3_
03991 >
03992 const type2_ pack<
03993 constant<type0_, value0_>,
03994 constant<type1_, value1_>,
03995 constant<type2_, value2_>,
03996 constant<type3_, value3_>
03997 >::i2;
03998
03999 template<
04000 typename type0_, type0_ value0_,
04001 typename type1_, type1_ value1_,
04002 typename type2_, type2_ value2_,
04003 typename type3_, type3_ value3_
04004 >
04005 const type3_ pack<
04006 constant<type0_, value0_>,
04007 constant<type1_, value1_>,
04008 constant<type2_, value2_>,
04009 constant<type3_, value3_>
04010 >::i3;
04011
04012
04013 template<
04014 typename type0_,
04015 typename type1_,
04016 typename type2_
04017 >
04018 class pack<
04019 type0_,
04020 type1_,
04021 type2_
04022 >
04023 {
04024 public:
04025 static const int n = 3;
04026
04027 typedef type0_ type0;
04028 typedef type1_ type1;
04029 typedef type2_ type2;
04030
04031 static const bool is_const0 = false;
04032 static const bool is_const1 = false;
04033 static const bool is_const2 = false;
04034 static const bool is_all_const = false;
04035 type0 i0;
04036 type1 i1;
04037 type2 i2;
04038
04039 LITE_INLINE pack()
04040 : i0(),i1(),i2() {}
04041
04042 LITE_INLINE pack(const type0& a0)
04043 : i0(a0)
04044 {}
04045
04046 LITE_INLINE pack(
04047 const type0& a0,
04048 const type1& a1,
04049 const type2& a2
04050 ) : i0(a0), i1(a1), i2(a2) {}
04051
04052 template<
04053 typename other_type0_ ,
04054 typename other_type1_ ,
04055 typename other_type2_
04056 >
04057 LITE_INLINE pack(const pack<
04058 other_type0_,
04059 other_type1_,
04060 other_type2_
04061 >& other) : i0(other.i0), i1(other.i1), i2(other.i2) {}
04062
04063 LITE_INLINE pack&
04064 operator= (const pack& other)
04065 {
04066 i0 = other.i0;
04067 i1 = other.i1;
04068 i2 = other.i2;
04069 return *this;
04070 }
04071
04072 template<
04073 typename other_type0_ ,
04074 typename other_type1_ ,
04075 typename other_type2_
04076 >
04077 LITE_INLINE pack&
04078 operator=(const pack<
04079 other_type0_,
04080 other_type1_,
04081 other_type2_
04082 >& other)
04083 {
04084 i0 = other.i0;
04085 i1 = other.i1;
04086 i2 = other.i2;
04087 return *this;
04088 }
04089
04090 LITE_INLINE void set(
04091 const type0& a0,
04092 const type1& a1,
04093 const type2& a2
04094 )
04095 {
04096 i0 = a0;
04097 i1 = a1;
04098 i2 = a2;
04099 }
04100 };
04101
04102
04103
04104 template<
04105 typename type0_, type0_ value0_,
04106 typename type1_,
04107 typename type2_
04108 >
04109 class pack<
04110 constant<type0_, value0_>,
04111 type1_,
04112 type2_
04113 >
04114 {
04115 public:
04116 static const int n = 3;
04117
04118 typedef type0_ type0;
04119 typedef type1_ type1;
04120 typedef type2_ type2;
04121
04122 static const bool is_const0 = true;
04123 static const bool is_const1 = false;
04124 static const bool is_const2 = false;
04125 static const bool is_all_const = false;
04126 static const type0 i0 = value0_;
04127 type1 i1;
04128 type2 i2;
04129
04130 LITE_INLINE pack()
04131 : i1(),i2() {}
04132
04133 LITE_INLINE pack(const type0& )
04134 {}
04135
04136 LITE_INLINE pack(
04137 const type0& ,
04138 const type1& a1,
04139 const type2& a2
04140 ) : i1(a1), i2(a2) {}
04141
04142 template<
04143 typename other_type0_ ,
04144 typename other_type1_ ,
04145 typename other_type2_
04146 >
04147 LITE_INLINE pack(const pack<
04148 other_type0_,
04149 other_type1_,
04150 other_type2_
04151 >& other) : i1(other.i1), i2(other.i2) {}
04152
04153 LITE_INLINE pack&
04154 operator= (const pack& other)
04155 {
04156 i1 = other.i1;
04157 i2 = other.i2;
04158 return *this;
04159 }
04160
04161 template<
04162 typename other_type0_ ,
04163 typename other_type1_ ,
04164 typename other_type2_
04165 >
04166 LITE_INLINE pack&
04167 operator=(const pack<
04168 other_type0_,
04169 other_type1_,
04170 other_type2_
04171 >& other)
04172 {
04173 i1 = other.i1;
04174 i2 = other.i2;
04175 return *this;
04176 }
04177
04178 LITE_INLINE void set(
04179 const type0& ,
04180 const type1& a1,
04181 const type2& a2
04182 )
04183 {
04184 i1 = a1;
04185 i2 = a2;
04186 }
04187 };
04188
04189
04190 template<
04191 typename type0_, type0_ value0_,
04192 typename type1_,
04193 typename type2_
04194 >
04195 const type0_ pack<
04196 constant<type0_, value0_>,
04197 type1_,
04198 type2_
04199 >::i0;
04200
04201
04202 template<
04203 typename type0_,
04204 typename type1_, type1_ value1_,
04205 typename type2_
04206 >
04207 class pack<
04208 type0_,
04209 constant<type1_, value1_>,
04210 type2_
04211 >
04212 {
04213 public:
04214 static const int n = 3;
04215
04216 typedef type0_ type0;
04217 typedef type1_ type1;
04218 typedef type2_ type2;
04219
04220 static const bool is_const0 = false;
04221 static const bool is_const1 = true;
04222 static const bool is_const2 = false;
04223 static const bool is_all_const = false;
04224 type0 i0;
04225 static const type1 i1 = value1_;
04226 type2 i2;
04227
04228 LITE_INLINE pack()
04229 : i0(),i2() {}
04230
04231 LITE_INLINE pack(const type0& a0)
04232 : i0(a0)
04233 {}
04234
04235 LITE_INLINE pack(
04236 const type0& a0,
04237 const type1& ,
04238 const type2& a2
04239 ) : i0(a0), i2(a2) {}
04240
04241 template<
04242 typename other_type0_ ,
04243 typename other_type1_ ,
04244 typename other_type2_
04245 >
04246 LITE_INLINE pack(const pack<
04247 other_type0_,
04248 other_type1_,
04249 other_type2_
04250 >& other) : i0(other.i0), i2(other.i2) {}
04251
04252 LITE_INLINE pack&
04253 operator= (const pack& other)
04254 {
04255 i0 = other.i0;
04256 i2 = other.i2;
04257 return *this;
04258 }
04259
04260 template<
04261 typename other_type0_ ,
04262 typename other_type1_ ,
04263 typename other_type2_
04264 >
04265 LITE_INLINE pack&
04266 operator=(const pack<
04267 other_type0_,
04268 other_type1_,
04269 other_type2_
04270 >& other)
04271 {
04272 i0 = other.i0;
04273 i2 = other.i2;
04274 return *this;
04275 }
04276
04277 LITE_INLINE void set(
04278 const type0& a0,
04279 const type1& ,
04280 const type2& a2
04281 )
04282 {
04283 i0 = a0;
04284 i2 = a2;
04285 }
04286 };
04287
04288
04289 template<
04290 typename type0_,
04291 typename type1_, type1_ value1_,
04292 typename type2_
04293 >
04294 const type1_ pack<
04295 type0_,
04296 constant<type1_, value1_>,
04297 type2_
04298 >::i1;
04299
04300
04301 template<
04302 typename type0_, type0_ value0_,
04303 typename type1_, type1_ value1_,
04304 typename type2_
04305 >
04306 class pack<
04307 constant<type0_, value0_>,
04308 constant<type1_, value1_>,
04309 type2_
04310 >
04311 {
04312 public:
04313 static const int n = 3;
04314
04315 typedef type0_ type0;
04316 typedef type1_ type1;
04317 typedef type2_ type2;
04318
04319 static const bool is_const0 = true;
04320 static const bool is_const1 = true;
04321 static const bool is_const2 = false;
04322 static const bool is_all_const = false;
04323 static const type0 i0 = value0_;
04324 static const type1 i1 = value1_;
04325 type2 i2;
04326
04327 LITE_INLINE pack()
04328 : i2() {}
04329
04330 LITE_INLINE pack(const type0& )
04331 {}
04332
04333 LITE_INLINE pack(
04334 const type0& ,
04335 const type1& ,
04336 const type2& a2
04337 ) : i2(a2) {}
04338
04339 template<
04340 typename other_type0_ ,
04341 typename other_type1_ ,
04342 typename other_type2_
04343 >
04344 LITE_INLINE pack(const pack<
04345 other_type0_,
04346 other_type1_,
04347 other_type2_
04348 >& other) : i2(other.i2) {}
04349
04350 LITE_INLINE pack&
04351 operator= (const pack& other)
04352 {
04353 i2 = other.i2;
04354 return *this;
04355 }
04356
04357 template<
04358 typename other_type0_ ,
04359 typename other_type1_ ,
04360 typename other_type2_
04361 >
04362 LITE_INLINE pack&
04363 operator=(const pack<
04364 other_type0_,
04365 other_type1_,
04366 other_type2_
04367 >& other)
04368 {
04369 i2 = other.i2;
04370 return *this;
04371 }
04372
04373 LITE_INLINE void set(
04374 const type0& ,
04375 const type1& ,
04376 const type2& a2
04377 )
04378 {
04379 i2 = a2;
04380 }
04381 };
04382
04383
04384 template<
04385 typename type0_, type0_ value0_,
04386 typename type1_, type1_ value1_,
04387 typename type2_
04388 >
04389 const type0_ pack<
04390 constant<type0_, value0_>,
04391 constant<type1_, value1_>,
04392 type2_
04393 >::i0;
04394
04395 template<
04396 typename type0_, type0_ value0_,
04397 typename type1_, type1_ value1_,
04398 typename type2_
04399 >
04400 const type1_ pack<
04401 constant<type0_, value0_>,
04402 constant<type1_, value1_>,
04403 type2_
04404 >::i1;
04405
04406
04407 template<
04408 typename type0_,
04409 typename type1_,
04410 typename type2_, type2_ value2_
04411 >
04412 class pack<
04413 type0_,
04414 type1_,
04415 constant<type2_, value2_>
04416 >
04417 {
04418 public:
04419 static const int n = 3;
04420
04421 typedef type0_ type0;
04422 typedef type1_ type1;
04423 typedef type2_ type2;
04424
04425 static const bool is_const0 = false;
04426 static const bool is_const1 = false;
04427 static const bool is_const2 = true;
04428 static const bool is_all_const = false;
04429 type0 i0;
04430 type1 i1;
04431 static const type2 i2 = value2_;
04432
04433 LITE_INLINE pack()
04434 : i0(),i1() {}
04435
04436 LITE_INLINE pack(const type0& a0)
04437 : i0(a0)
04438 {}
04439
04440 LITE_INLINE pack(
04441 const type0& a0,
04442 const type1& a1,
04443 const type2&
04444 ) : i0(a0), i1(a1) {}
04445
04446 template<
04447 typename other_type0_ ,
04448 typename other_type1_ ,
04449 typename other_type2_
04450 >
04451 LITE_INLINE pack(const pack<
04452 other_type0_,
04453 other_type1_,
04454 other_type2_
04455 >& other) : i0(other.i0), i1(other.i1) {}
04456
04457 LITE_INLINE pack&
04458 operator= (const pack& other)
04459 {
04460 i0 = other.i0;
04461 i1 = other.i1;
04462 return *this;
04463 }
04464
04465 template<
04466 typename other_type0_ ,
04467 typename other_type1_ ,
04468 typename other_type2_
04469 >
04470 LITE_INLINE pack&
04471 operator=(const pack<
04472 other_type0_,
04473 other_type1_,
04474 other_type2_
04475 >& other)
04476 {
04477 i0 = other.i0;
04478 i1 = other.i1;
04479 return *this;
04480 }
04481
04482 LITE_INLINE void set(
04483 const type0& a0,
04484 const type1& a1,
04485 const type2&
04486 )
04487 {
04488 i0 = a0;
04489 i1 = a1;
04490 }
04491 };
04492
04493
04494 template<
04495 typename type0_,
04496 typename type1_,
04497 typename type2_, type2_ value2_
04498 >
04499 const type2_ pack<
04500 type0_,
04501 type1_,
04502 constant<type2_, value2_>
04503 >::i2;
04504
04505
04506 template<
04507 typename type0_, type0_ value0_,
04508 typename type1_,
04509 typename type2_, type2_ value2_
04510 >
04511 class pack<
04512 constant<type0_, value0_>,
04513 type1_,
04514 constant<type2_, value2_>
04515 >
04516 {
04517 public:
04518 static const int n = 3;
04519
04520 typedef type0_ type0;
04521 typedef type1_ type1;
04522 typedef type2_ type2;
04523
04524 static const bool is_const0 = true;
04525 static const bool is_const1 = false;
04526 static const bool is_const2 = true;
04527 static const bool is_all_const = false;
04528 static const type0 i0 = value0_;
04529 type1 i1;
04530 static const type2 i2 = value2_;
04531
04532 LITE_INLINE pack()
04533 : i1() {}
04534
04535 LITE_INLINE pack(const type0& )
04536 {}
04537
04538 LITE_INLINE pack(
04539 const type0& ,
04540 const type1& a1,
04541 const type2&
04542 ) : i1(a1) {}
04543
04544 template<
04545 typename other_type0_ ,
04546 typename other_type1_ ,
04547 typename other_type2_
04548 >
04549 LITE_INLINE pack(const pack<
04550 other_type0_,
04551 other_type1_,
04552 other_type2_
04553 >& other) : i1(other.i1) {}
04554
04555 LITE_INLINE pack&
04556 operator= (const pack& other)
04557 {
04558 i1 = other.i1;
04559 return *this;
04560 }
04561
04562 template<
04563 typename other_type0_ ,
04564 typename other_type1_ ,
04565 typename other_type2_
04566 >
04567 LITE_INLINE pack&
04568 operator=(const pack<
04569 other_type0_,
04570 other_type1_,
04571 other_type2_
04572 >& other)
04573 {
04574 i1 = other.i1;
04575 return *this;
04576 }
04577
04578 LITE_INLINE void set(
04579 const type0& ,
04580 const type1& a1,
04581 const type2&
04582 )
04583 {
04584 i1 = a1;
04585 }
04586 };
04587
04588
04589 template<
04590 typename type0_, type0_ value0_,
04591 typename type1_,
04592 typename type2_, type2_ value2_
04593 >
04594 const type0_ pack<
04595 constant<type0_, value0_>,
04596 type1_,
04597 constant<type2_, value2_>
04598 >::i0;
04599
04600 template<
04601 typename type0_, type0_ value0_,
04602 typename type1_,
04603 typename type2_, type2_ value2_
04604 >
04605 const type2_ pack<
04606 constant<type0_, value0_>,
04607 type1_,
04608 constant<type2_, value2_>
04609 >::i2;
04610
04611
04612 template<
04613 typename type0_,
04614 typename type1_, type1_ value1_,
04615 typename type2_, type2_ value2_
04616 >
04617 class pack<
04618 type0_,
04619 constant<type1_, value1_>,
04620 constant<type2_, value2_>
04621 >
04622 {
04623 public:
04624 static const int n = 3;
04625
04626 typedef type0_ type0;
04627 typedef type1_ type1;
04628 typedef type2_ type2;
04629
04630 static const bool is_const0 = false;
04631 static const bool is_const1 = true;
04632 static const bool is_const2 = true;
04633 static const bool is_all_const = false;
04634 type0 i0;
04635 static const type1 i1 = value1_;
04636 static const type2 i2 = value2_;
04637
04638 LITE_INLINE pack()
04639 : i0() {}
04640
04641 LITE_INLINE pack(const type0& a0)
04642 : i0(a0)
04643 {}
04644
04645 LITE_INLINE pack(
04646 const type0& a0,
04647 const type1& ,
04648 const type2&
04649 ) : i0(a0) {}
04650
04651 template<
04652 typename other_type0_ ,
04653 typename other_type1_ ,
04654 typename other_type2_
04655 >
04656 LITE_INLINE pack(const pack<
04657 other_type0_,
04658 other_type1_,
04659 other_type2_
04660 >& other) : i0(other.i0) {}
04661
04662 LITE_INLINE pack&
04663 operator= (const pack& other)
04664 {
04665 i0 = other.i0;
04666 return *this;
04667 }
04668
04669 template<
04670 typename other_type0_ ,
04671 typename other_type1_ ,
04672 typename other_type2_
04673 >
04674 LITE_INLINE pack&
04675 operator=(const pack<
04676 other_type0_,
04677 other_type1_,
04678 other_type2_
04679 >& other)
04680 {
04681 i0 = other.i0;
04682 return *this;
04683 }
04684
04685 LITE_INLINE void set(
04686 const type0& a0,
04687 const type1& ,
04688 const type2&
04689 )
04690 {
04691 i0 = a0;
04692 }
04693 };
04694
04695
04696 template<
04697 typename type0_,
04698 typename type1_, type1_ value1_,
04699 typename type2_, type2_ value2_
04700 >
04701 const type1_ pack<
04702 type0_,
04703 constant<type1_, value1_>,
04704 constant<type2_, value2_>
04705 >::i1;
04706
04707 template<
04708 typename type0_,
04709 typename type1_, type1_ value1_,
04710 typename type2_, type2_ value2_
04711 >
04712 const type2_ pack<
04713 type0_,
04714 constant<type1_, value1_>,
04715 constant<type2_, value2_>
04716 >::i2;
04717
04718
04719 template<
04720 typename type0_, type0_ value0_,
04721 typename type1_, type1_ value1_,
04722 typename type2_, type2_ value2_
04723 >
04724 class pack<
04725 constant<type0_, value0_>,
04726 constant<type1_, value1_>,
04727 constant<type2_, value2_>
04728 >
04729 {
04730 public:
04731 static const int n = 3;
04732
04733 typedef type0_ type0;
04734 typedef type1_ type1;
04735 typedef type2_ type2;
04736
04737 static const bool is_const0 = true;
04738 static const bool is_const1 = true;
04739 static const bool is_const2 = true;
04740 static const bool is_all_const = true;
04741 static const type0 i0 = value0_;
04742 static const type1 i1 = value1_;
04743 static const type2 i2 = value2_;
04744
04745 LITE_INLINE pack()
04746 {}
04747
04748 LITE_INLINE pack(const type0& )
04749 {}
04750
04751 LITE_INLINE pack(
04752 const type0& ,
04753 const type1& ,
04754 const type2&
04755 ) {}
04756
04757 template<
04758 typename other_type0_ ,
04759 typename other_type1_ ,
04760 typename other_type2_
04761 >
04762 LITE_INLINE pack(const pack<
04763 other_type0_,
04764 other_type1_,
04765 other_type2_
04766 >& ) {}
04767
04768 LITE_INLINE pack&
04769 operator= (const pack& )
04770 {
04771 return *this;
04772 }
04773
04774 template<
04775 typename other_type0_ ,
04776 typename other_type1_ ,
04777 typename other_type2_
04778 >
04779 LITE_INLINE pack&
04780 operator=(const pack<
04781 other_type0_,
04782 other_type1_,
04783 other_type2_
04784 >& )
04785 {
04786 return *this;
04787 }
04788
04789 LITE_INLINE void set(
04790 const type0& ,
04791 const type1& ,
04792 const type2&
04793 )
04794 {
04795 }
04796 };
04797
04798
04799 template<
04800 typename type0_, type0_ value0_,
04801 typename type1_, type1_ value1_,
04802 typename type2_, type2_ value2_
04803 >
04804 const type0_ pack<
04805 constant<type0_, value0_>,
04806 constant<type1_, value1_>,
04807 constant<type2_, value2_>
04808 >::i0;
04809
04810 template<
04811 typename type0_, type0_ value0_,
04812 typename type1_, type1_ value1_,
04813 typename type2_, type2_ value2_
04814 >
04815 const type1_ pack<
04816 constant<type0_, value0_>,
04817 constant<type1_, value1_>,
04818 constant<type2_, value2_>
04819 >::i1;
04820
04821 template<
04822 typename type0_, type0_ value0_,
04823 typename type1_, type1_ value1_,
04824 typename type2_, type2_ value2_
04825 >
04826 const type2_ pack<
04827 constant<type0_, value0_>,
04828 constant<type1_, value1_>,
04829 constant<type2_, value2_>
04830 >::i2;
04831
04832
04833 template<
04834 typename type0_,
04835 typename type1_
04836 >
04837 class pack<
04838 type0_,
04839 type1_
04840 >
04841 {
04842 public:
04843 static const int n = 2;
04844
04845 typedef type0_ type0;
04846 typedef type1_ type1;
04847
04848 static const bool is_const0 = false;
04849 static const bool is_const1 = false;
04850 static const bool is_all_const = false;
04851 type0 i0;
04852 type1 i1;
04853
04854 LITE_INLINE pack()
04855 : i0(),i1() {}
04856
04857 LITE_INLINE pack(const type0& a0)
04858 : i0(a0)
04859 {}
04860
04861 LITE_INLINE pack(
04862 const type0& a0,
04863 const type1& a1
04864 ) : i0(a0), i1(a1) {}
04865
04866 template<
04867 typename other_type0_ ,
04868 typename other_type1_
04869 >
04870 LITE_INLINE pack(const pack<
04871 other_type0_,
04872 other_type1_
04873 >& other) : i0(other.i0), i1(other.i1) {}
04874
04875 LITE_INLINE pack&
04876 operator= (const pack& other)
04877 {
04878 i0 = other.i0;
04879 i1 = other.i1;
04880 return *this;
04881 }
04882
04883 template<
04884 typename other_type0_ ,
04885 typename other_type1_
04886 >
04887 LITE_INLINE pack&
04888 operator=(const pack<
04889 other_type0_,
04890 other_type1_
04891 >& other)
04892 {
04893 i0 = other.i0;
04894 i1 = other.i1;
04895 return *this;
04896 }
04897
04898 LITE_INLINE void set(
04899 const type0& a0,
04900 const type1& a1
04901 )
04902 {
04903 i0 = a0;
04904 i1 = a1;
04905 }
04906 };
04907
04908
04909
04910 template<
04911 typename type0_, type0_ value0_,
04912 typename type1_
04913 >
04914 class pack<
04915 constant<type0_, value0_>,
04916 type1_
04917 >
04918 {
04919 public:
04920 static const int n = 2;
04921
04922 typedef type0_ type0;
04923 typedef type1_ type1;
04924
04925 static const bool is_const0 = true;
04926 static const bool is_const1 = false;
04927 static const bool is_all_const = false;
04928 static const type0 i0 = value0_;
04929 type1 i1;
04930
04931 LITE_INLINE pack()
04932 : i1() {}
04933
04934 LITE_INLINE pack(const type0& )
04935 {}
04936
04937 LITE_INLINE pack(
04938 const type0& ,
04939 const type1& a1
04940 ) : i1(a1) {}
04941
04942 template<
04943 typename other_type0_ ,
04944 typename other_type1_
04945 >
04946 LITE_INLINE pack(const pack<
04947 other_type0_,
04948 other_type1_
04949 >& other) : i1(other.i1) {}
04950
04951 LITE_INLINE pack&
04952 operator= (const pack& other)
04953 {
04954 i1 = other.i1;
04955 return *this;
04956 }
04957
04958 template<
04959 typename other_type0_ ,
04960 typename other_type1_
04961 >
04962 LITE_INLINE pack&
04963 operator=(const pack<
04964 other_type0_,
04965 other_type1_
04966 >& other)
04967 {
04968 i1 = other.i1;
04969 return *this;
04970 }
04971
04972 LITE_INLINE void set(
04973 const type0& ,
04974 const type1& a1
04975 )
04976 {
04977 i1 = a1;
04978 }
04979 };
04980
04981
04982 template<
04983 typename type0_, type0_ value0_,
04984 typename type1_
04985 >
04986 const type0_ pack<
04987 constant<type0_, value0_>,
04988 type1_
04989 >::i0;
04990
04991
04992 template<
04993 typename type0_,
04994 typename type1_, type1_ value1_
04995 >
04996 class pack<
04997 type0_,
04998 constant<type1_, value1_>
04999 >
05000 {
05001 public:
05002 static const int n = 2;
05003
05004 typedef type0_ type0;
05005 typedef type1_ type1;
05006
05007 static const bool is_const0 = false;
05008 static const bool is_const1 = true;
05009 static const bool is_all_const = false;
05010 type0 i0;
05011 static const type1 i1 = value1_;
05012
05013 LITE_INLINE pack()
05014 : i0() {}
05015
05016 LITE_INLINE pack(const type0& a0)
05017 : i0(a0)
05018 {}
05019
05020 LITE_INLINE pack(
05021 const type0& a0,
05022 const type1&
05023 ) : i0(a0) {}
05024
05025 template<
05026 typename other_type0_ ,
05027 typename other_type1_
05028 >
05029 LITE_INLINE pack(const pack<
05030 other_type0_,
05031 other_type1_
05032 >& other) : i0(other.i0) {}
05033
05034 LITE_INLINE pack&
05035 operator= (const pack& other)
05036 {
05037 i0 = other.i0;
05038 return *this;
05039 }
05040
05041 template<
05042 typename other_type0_ ,
05043 typename other_type1_
05044 >
05045 LITE_INLINE pack&
05046 operator=(const pack<
05047 other_type0_,
05048 other_type1_
05049 >& other)
05050 {
05051 i0 = other.i0;
05052 return *this;
05053 }
05054
05055 LITE_INLINE void set(
05056 const type0& a0,
05057 const type1&
05058 )
05059 {
05060 i0 = a0;
05061 }
05062 };
05063
05064
05065 template<
05066 typename type0_,
05067 typename type1_, type1_ value1_
05068 >
05069 const type1_ pack<
05070 type0_,
05071 constant<type1_, value1_>
05072 >::i1;
05073
05074
05075 template<
05076 typename type0_, type0_ value0_,
05077 typename type1_, type1_ value1_
05078 >
05079 class pack<
05080 constant<type0_, value0_>,
05081 constant<type1_, value1_>
05082 >
05083 {
05084 public:
05085 static const int n = 2;
05086
05087 typedef type0_ type0;
05088 typedef type1_ type1;
05089
05090 static const bool is_const0 = true;
05091 static const bool is_const1 = true;
05092 static const bool is_all_const = true;
05093 static const type0 i0 = value0_;
05094 static const type1 i1 = value1_;
05095
05096 LITE_INLINE pack()
05097 {}
05098
05099 LITE_INLINE pack(const type0& )
05100 {}
05101
05102 LITE_INLINE pack(
05103 const type0& ,
05104 const type1&
05105 ) {}
05106
05107 template<
05108 typename other_type0_ ,
05109 typename other_type1_
05110 >
05111 LITE_INLINE pack(const pack<
05112 other_type0_,
05113 other_type1_
05114 >& ) {}
05115
05116 LITE_INLINE pack&
05117 operator= (const pack& )
05118 {
05119 return *this;
05120 }
05121
05122 template<
05123 typename other_type0_ ,
05124 typename other_type1_
05125 >
05126 LITE_INLINE pack&
05127 operator=(const pack<
05128 other_type0_,
05129 other_type1_
05130 >& )
05131 {
05132 return *this;
05133 }
05134
05135 LITE_INLINE void set(
05136 const type0& ,
05137 const type1&
05138 )
05139 {
05140 }
05141 };
05142
05143
05144 template<
05145 typename type0_, type0_ value0_,
05146 typename type1_, type1_ value1_
05147 >
05148 const type0_ pack<
05149 constant<type0_, value0_>,
05150 constant<type1_, value1_>
05151 >::i0;
05152
05153 template<
05154 typename type0_, type0_ value0_,
05155 typename type1_, type1_ value1_
05156 >
05157 const type1_ pack<
05158 constant<type0_, value0_>,
05159 constant<type1_, value1_>
05160 >::i1;
05161
05162
05163 template<
05164 typename type0_
05165 >
05166 class pack<
05167 type0_
05168 >
05169 {
05170 public:
05171 static const int n = 1;
05172
05173 typedef type0_ type0;
05174
05175 static const bool is_const0 = false;
05176 static const bool is_all_const = false;
05177 type0 i0;
05178
05179 LITE_INLINE pack()
05180 : i0() {}
05181
05182
05183 LITE_INLINE pack(
05184 const type0& a0
05185 ) : i0(a0) {}
05186
05187 template<
05188 typename other_type0_
05189 >
05190 LITE_INLINE pack(const pack<
05191 other_type0_
05192 >& other) : i0(other.i0) {}
05193
05194 LITE_INLINE pack&
05195 operator= (const pack& other)
05196 {
05197 i0 = other.i0;
05198 return *this;
05199 }
05200
05201 template<
05202 typename other_type0_
05203 >
05204 LITE_INLINE pack&
05205 operator=(const pack<
05206 other_type0_
05207 >& other)
05208 {
05209 i0 = other.i0;
05210 return *this;
05211 }
05212
05213 LITE_INLINE void set(
05214 const type0& a0
05215 )
05216 {
05217 i0 = a0;
05218 }
05219 };
05220
05221
05222
05223 template<
05224 typename type0_, type0_ value0_
05225 >
05226 class pack<
05227 constant<type0_, value0_>
05228 >
05229 {
05230 public:
05231 static const int n = 1;
05232
05233 typedef type0_ type0;
05234
05235 static const bool is_const0 = true;
05236 static const bool is_all_const = true;
05237 static const type0 i0 = value0_;
05238
05239 LITE_INLINE pack()
05240 {}
05241
05242
05243 LITE_INLINE pack(
05244 const type0&
05245 ) {}
05246
05247 template<
05248 typename other_type0_
05249 >
05250 LITE_INLINE pack(const pack<
05251 other_type0_
05252 >& ) {}
05253
05254 LITE_INLINE pack&
05255 operator= (const pack& )
05256 {
05257 return *this;
05258 }
05259
05260 template<
05261 typename other_type0_
05262 >
05263 LITE_INLINE pack&
05264 operator=(const pack<
05265 other_type0_
05266 >& )
05267 {
05268 return *this;
05269 }
05270
05271 LITE_INLINE void set(
05272 const type0&
05273 )
05274 {
05275 }
05276 };
05277
05278
05279 template<
05280 typename type0_, type0_ value0_
05281 >
05282 const type0_ pack<
05283 constant<type0_, value0_>
05284 >::i0;
05285
05286
05287
05288
05289
05290
05291 template<>
05292 class pack<>
05293 {
05294 public:
05295 static const int n = 0;
05296
05297 LITE_INLINE pack() {}
05298
05299 LITE_INLINE pack(const pack&) {}
05300
05301 LITE_INLINE pack& operator= (const pack&)
05302 { return *this; }
05303
05304 LITE_INLINE void set()
05305 {}
05306 };
05307
05308 #endif // !DOCUMENTATION_ONLY
05309
05310
05311
05312
05313
05314 #ifdef DOCUMENTATION_ONLY
05315
05355 template<typename pack_type_, bool keep0_ ..., bool keepN_>
05356 class sub_pack
05357 {
05358 public:
05359 typedef pack_type_ input_pack_type;
05360
05361 typedef pack<...> type;
05362
05364 static void set(type& res, input_pack_type::type0 a0, ..., input_pack_type::typeN aN);
05365
05367 static void set(type& res, const input_pack_type& org);
05368 };
05369
05370 #else // DOCUMENTATION_ONLY
05371
05372
05373 template<
05374 >
05375 class sub_pack<
05376 pack<
05377 >
05378 >
05379 {
05380 public:
05381 typedef pack<
05382 > input_pack_type;
05383
05384 typedef pack<
05385 > type;
05386
05387 static LITE_INLINE void set(
05388 type& res
05389 )
05390 {
05391 res.set();
05392 }
05393
05394 static LITE_INLINE void set(type& res, const input_pack_type& org)
05395 {
05396 res.set();
05397 LITE_ARRAY_USE(org);
05398 }
05399 };
05400
05401
05402
05403 template<
05404 typename type0_
05405 >
05406 class sub_pack<
05407 pack<
05408 type0_
05409 >,
05410 false
05411 >
05412 {
05413 public:
05414 typedef pack<
05415 type0_
05416 > input_pack_type;
05417
05418 typedef pack<
05419 > type;
05420
05421 static LITE_INLINE void set(
05422 type& res,
05423 const typename input_pack_type::type0&
05424 )
05425 {
05426 res.set();
05427 }
05428
05429 static LITE_INLINE void set(type& res, const input_pack_type& org)
05430 {
05431 res.set();
05432 LITE_ARRAY_USE(org);
05433 }
05434 };
05435
05436
05437
05438 template<
05439 typename type0_
05440 >
05441 class sub_pack<
05442 pack<
05443 type0_
05444 >,
05445 true
05446 >
05447 {
05448 public:
05449 typedef pack<
05450 type0_
05451 > input_pack_type;
05452
05453 typedef pack<
05454 type0_
05455 > type;
05456
05457 static LITE_INLINE void set(
05458 type& res,
05459 const typename input_pack_type::type0& a0
05460 )
05461 {
05462 res.set(a0);
05463 }
05464
05465 static LITE_INLINE void set(type& res, const input_pack_type& org)
05466 {
05467 res.set(org.i0);
05468 LITE_ARRAY_USE(org);
05469 }
05470 };
05471
05472
05473
05474 template<
05475 typename type0_,
05476 typename type1_
05477 >
05478 class sub_pack<
05479 pack<
05480 type0_,
05481 type1_
05482 >,
05483 false,
05484 false
05485 >
05486 {
05487 public:
05488 typedef pack<
05489 type0_,
05490 type1_
05491 > input_pack_type;
05492
05493 typedef pack<
05494 > type;
05495
05496 static LITE_INLINE void set(
05497 type& res,
05498 const typename input_pack_type::type0& ,
05499 const typename input_pack_type::type1&
05500 )
05501 {
05502 res.set();
05503 }
05504
05505 static LITE_INLINE void set(type& res, const input_pack_type& org)
05506 {
05507 res.set();
05508 LITE_ARRAY_USE(org);
05509 }
05510 };
05511
05512
05513
05514 template<
05515 typename type0_,
05516 typename type1_
05517 >
05518 class sub_pack<
05519 pack<
05520 type0_,
05521 type1_
05522 >,
05523 true,
05524 false
05525 >
05526 {
05527 public:
05528 typedef pack<
05529 type0_,
05530 type1_
05531 > input_pack_type;
05532
05533 typedef pack<
05534 type0_
05535 > type;
05536
05537 static LITE_INLINE void set(
05538 type& res,
05539 const typename input_pack_type::type0& a0,
05540 const typename input_pack_type::type1&
05541 )
05542 {
05543 res.set(a0);
05544 }
05545
05546 static LITE_INLINE void set(type& res, const input_pack_type& org)
05547 {
05548 res.set(org.i0);
05549 LITE_ARRAY_USE(org);
05550 }
05551 };
05552
05553
05554
05555 template<
05556 typename type0_,
05557 typename type1_
05558 >
05559 class sub_pack<
05560 pack<
05561 type0_,
05562 type1_
05563 >,
05564 false,
05565 true
05566 >
05567 {
05568 public:
05569 typedef pack<
05570 type0_,
05571 type1_
05572 > input_pack_type;
05573
05574 typedef pack<
05575 type1_
05576 > type;
05577
05578 static LITE_INLINE void set(
05579 type& res,
05580 const typename input_pack_type::type0& ,
05581 const typename input_pack_type::type1& a1
05582 )
05583 {
05584 res.set(a1);
05585 }
05586
05587 static LITE_INLINE void set(type& res, const input_pack_type& org)
05588 {
05589 res.set(org.i1);
05590 LITE_ARRAY_USE(org);
05591 }
05592 };
05593
05594
05595
05596 template<
05597 typename type0_,
05598 typename type1_
05599 >
05600 class sub_pack<
05601 pack<
05602 type0_,
05603 type1_
05604 >,
05605 true,
05606 true
05607 >
05608 {
05609 public:
05610 typedef pack<
05611 type0_,
05612 type1_
05613 > input_pack_type;
05614
05615 typedef pack<
05616 type0_,
05617 type1_
05618 > type;
05619
05620 static LITE_INLINE void set(
05621 type& res,
05622 const typename input_pack_type::type0& a0,
05623 const typename input_pack_type::type1& a1
05624 )
05625 {
05626 res.set(a0,a1);
05627 }
05628
05629 static LITE_INLINE void set(type& res, const input_pack_type& org)
05630 {
05631 res.set(org.i0,org.i1);
05632 LITE_ARRAY_USE(org);
05633 }
05634 };
05635
05636
05637
05638 template<
05639 typename type0_,
05640 typename type1_,
05641 typename type2_
05642 >
05643 class sub_pack<
05644 pack<
05645 type0_,
05646 type1_,
05647 type2_
05648 >,
05649 false,
05650 false,
05651 false
05652 >
05653 {
05654 public:
05655 typedef pack<
05656 type0_,
05657 type1_,
05658 type2_
05659 > input_pack_type;
05660
05661 typedef pack<
05662 > type;
05663
05664 static LITE_INLINE void set(
05665 type& res,
05666 const typename input_pack_type::type0& ,
05667 const typename input_pack_type::type1& ,
05668 const typename input_pack_type::type2&
05669 )
05670 {
05671 res.set();
05672 }
05673
05674 static LITE_INLINE void set(type& res, const input_pack_type& org)
05675 {
05676 res.set();
05677 LITE_ARRAY_USE(org);
05678 }
05679 };
05680
05681
05682
05683 template<
05684 typename type0_,
05685 typename type1_,
05686 typename type2_
05687 >
05688 class sub_pack<
05689 pack<
05690 type0_,
05691 type1_,
05692 type2_
05693 >,
05694 true,
05695 false,
05696 false
05697 >
05698 {
05699 public:
05700 typedef pack<
05701 type0_,
05702 type1_,
05703 type2_
05704 > input_pack_type;
05705
05706 typedef pack<
05707 type0_
05708 > type;
05709
05710 static LITE_INLINE void set(
05711 type& res,
05712 const typename input_pack_type::type0& a0,
05713 const typename input_pack_type::type1& ,
05714 const typename input_pack_type::type2&
05715 )
05716 {
05717 res.set(a0);
05718 }
05719
05720 static LITE_INLINE void set(type& res, const input_pack_type& org)
05721 {
05722 res.set(org.i0);
05723 LITE_ARRAY_USE(org);
05724 }
05725 };
05726
05727
05728
05729 template<
05730 typename type0_,
05731 typename type1_,
05732 typename type2_
05733 >
05734 class sub_pack<
05735 pack<
05736 type0_,
05737 type1_,
05738 type2_
05739 >,
05740 false,
05741 true,
05742 false
05743 >
05744 {
05745 public:
05746 typedef pack<
05747 type0_,
05748 type1_,
05749 type2_
05750 > input_pack_type;
05751
05752 typedef pack<
05753 type1_
05754 > type;
05755
05756 static LITE_INLINE void set(
05757 type& res,
05758 const typename input_pack_type::type0& ,
05759 const typename input_pack_type::type1& a1,
05760 const typename input_pack_type::type2&
05761 )
05762 {
05763 res.set(a1);
05764 }
05765
05766 static LITE_INLINE void set(type& res, const input_pack_type& org)
05767 {
05768 res.set(org.i1);
05769 LITE_ARRAY_USE(org);
05770 }
05771 };
05772
05773
05774
05775 template<
05776 typename type0_,
05777 typename type1_,
05778 typename type2_
05779 >
05780 class sub_pack<
05781 pack<
05782 type0_,
05783 type1_,
05784 type2_
05785 >,
05786 true,
05787 true,
05788 false
05789 >
05790 {
05791 public:
05792 typedef pack<
05793 type0_,
05794 type1_,
05795 type2_
05796 > input_pack_type;
05797
05798 typedef pack<
05799 type0_,
05800 type1_
05801 > type;
05802
05803 static LITE_INLINE void set(
05804 type& res,
05805 const typename input_pack_type::type0& a0,
05806 const typename input_pack_type::type1& a1,
05807 const typename input_pack_type::type2&
05808 )
05809 {
05810 res.set(a0,a1);
05811 }
05812
05813 static LITE_INLINE void set(type& res, const input_pack_type& org)
05814 {
05815 res.set(org.i0,org.i1);
05816 LITE_ARRAY_USE(org);
05817 }
05818 };
05819
05820
05821
05822 template<
05823 typename type0_,
05824 typename type1_,
05825 typename type2_
05826 >
05827 class sub_pack<
05828 pack<
05829 type0_,
05830 type1_,
05831 type2_
05832 >,
05833 false,
05834 false,
05835 true
05836 >
05837 {
05838 public:
05839 typedef pack<
05840 type0_,
05841 type1_,
05842 type2_
05843 > input_pack_type;
05844
05845 typedef pack<
05846 type2_
05847 > type;
05848
05849 static LITE_INLINE void set(
05850 type& res,
05851 const typename input_pack_type::type0& ,
05852 const typename input_pack_type::type1& ,
05853 const typename input_pack_type::type2& a2
05854 )
05855 {
05856 res.set(a2);
05857 }
05858
05859 static LITE_INLINE void set(type& res, const input_pack_type& org)
05860 {
05861 res.set(org.i2);
05862 LITE_ARRAY_USE(org);
05863 }
05864 };
05865
05866
05867
05868 template<
05869 typename type0_,
05870 typename type1_,
05871 typename type2_
05872 >
05873 class sub_pack<
05874 pack<
05875 type0_,
05876 type1_,
05877 type2_
05878 >,
05879 true,
05880 false,
05881 true
05882 >
05883 {
05884 public:
05885 typedef pack<
05886 type0_,
05887 type1_,
05888 type2_
05889 > input_pack_type;
05890
05891 typedef pack<
05892 type0_,
05893 type2_
05894 > type;
05895
05896 static LITE_INLINE void set(
05897 type& res,
05898 const typename input_pack_type::type0& a0,
05899 const typename input_pack_type::type1& ,
05900 const typename input_pack_type::type2& a2
05901 )
05902 {
05903 res.set(a0,a2);
05904 }
05905
05906 static LITE_INLINE void set(type& res, const input_pack_type& org)
05907 {
05908 res.set(org.i0,org.i2);
05909 LITE_ARRAY_USE(org);
05910 }
05911 };
05912
05913
05914
05915 template<
05916 typename type0_,
05917 typename type1_,
05918 typename type2_
05919 >
05920 class sub_pack<
05921 pack<
05922 type0_,
05923 type1_,
05924 type2_
05925 >,
05926 false,
05927 true,
05928 true
05929 >
05930 {
05931 public:
05932 typedef pack<
05933 type0_,
05934 type1_,
05935 type2_
05936 > input_pack_type;
05937
05938 typedef pack<
05939 type1_,
05940 type2_
05941 > type;
05942
05943 static LITE_INLINE void set(
05944 type& res,
05945 const typename input_pack_type::type0& ,
05946 const typename input_pack_type::type1& a1,
05947 const typename input_pack_type::type2& a2
05948 )
05949 {
05950 res.set(a1,a2);
05951 }
05952
05953 static LITE_INLINE void set(type& res, const input_pack_type& org)
05954 {
05955 res.set(org.i1,org.i2);
05956 LITE_ARRAY_USE(org);
05957 }
05958 };
05959
05960
05961
05962 template<
05963 typename type0_,
05964 typename type1_,
05965 typename type2_
05966 >
05967 class sub_pack<
05968 pack<
05969 type0_,
05970 type1_,
05971 type2_
05972 >,
05973 true,
05974 true,
05975 true
05976 >
05977 {
05978 public:
05979 typedef pack<
05980 type0_,
05981 type1_,
05982 type2_
05983 > input_pack_type;
05984
05985 typedef pack<
05986 type0_,
05987 type1_,
05988 type2_
05989 > type;
05990
05991 static LITE_INLINE void set(
05992 type& res,
05993 const typename input_pack_type::type0& a0,
05994 const typename input_pack_type::type1& a1,
05995 const typename input_pack_type::type2& a2
05996 )
05997 {
05998 res.set(a0,a1,a2);
05999 }
06000
06001 static LITE_INLINE void set(type& res, const input_pack_type& org)
06002 {
06003 res.set(org.i0,org.i1,org.i2);
06004 LITE_ARRAY_USE(org);
06005 }
06006 };
06007
06008
06009
06010 template<
06011 typename type0_,
06012 typename type1_,
06013 typename type2_,
06014 typename type3_
06015 >
06016 class sub_pack<
06017 pack<
06018 type0_,
06019 type1_,
06020 type2_,
06021 type3_
06022 >,
06023 false,
06024 false,
06025 false,
06026 false
06027 >
06028 {
06029 public:
06030 typedef pack<
06031 type0_,
06032 type1_,
06033 type2_,
06034 type3_
06035 > input_pack_type;
06036
06037 typedef pack<
06038 > type;
06039
06040 static LITE_INLINE void set(
06041 type& res,
06042 const typename input_pack_type::type0& ,
06043 const typename input_pack_type::type1& ,
06044 const typename input_pack_type::type2& ,
06045 const typename input_pack_type::type3&
06046 )
06047 {
06048 res.set();
06049 }
06050
06051 static LITE_INLINE void set(type& res, const input_pack_type& org)
06052 {
06053 res.set();
06054 LITE_ARRAY_USE(org);
06055 }
06056 };
06057
06058
06059
06060 template<
06061 typename type0_,
06062 typename type1_,
06063 typename type2_,
06064 typename type3_
06065 >
06066 class sub_pack<
06067 pack<
06068 type0_,
06069 type1_,
06070 type2_,
06071 type3_
06072 >,
06073 true,
06074 false,
06075 false,
06076 false
06077 >
06078 {
06079 public:
06080 typedef pack<
06081 type0_,
06082 type1_,
06083 type2_,
06084 type3_
06085 > input_pack_type;
06086
06087 typedef pack<
06088 type0_
06089 > type;
06090
06091 static LITE_INLINE void set(
06092 type& res,
06093 const typename input_pack_type::type0& a0,
06094 const typename input_pack_type::type1& ,
06095 const typename input_pack_type::type2& ,
06096 const typename input_pack_type::type3&
06097 )
06098 {
06099 res.set(a0);
06100 }
06101
06102 static LITE_INLINE void set(type& res, const input_pack_type& org)
06103 {
06104 res.set(org.i0);
06105 LITE_ARRAY_USE(org);
06106 }
06107 };
06108
06109
06110
06111 template<
06112 typename type0_,
06113 typename type1_,
06114 typename type2_,
06115 typename type3_
06116 >
06117 class sub_pack<
06118 pack<
06119 type0_,
06120 type1_,
06121 type2_,
06122 type3_
06123 >,
06124 false,
06125 true,
06126 false,
06127 false
06128 >
06129 {
06130 public:
06131 typedef pack<
06132 type0_,
06133 type1_,
06134 type2_,
06135 type3_
06136 > input_pack_type;
06137
06138 typedef pack<
06139 type1_
06140 > type;
06141
06142 static LITE_INLINE void set(
06143 type& res,
06144 const typename input_pack_type::type0& ,
06145 const typename input_pack_type::type1& a1,
06146 const typename input_pack_type::type2& ,
06147 const typename input_pack_type::type3&
06148 )
06149 {
06150 res.set(a1);
06151 }
06152
06153 static LITE_INLINE void set(type& res, const input_pack_type& org)
06154 {
06155 res.set(org.i1);
06156 LITE_ARRAY_USE(org);
06157 }
06158 };
06159
06160
06161
06162 template<
06163 typename type0_,
06164 typename type1_,
06165 typename type2_,
06166 typename type3_
06167 >
06168 class sub_pack<
06169 pack<
06170 type0_,
06171 type1_,
06172 type2_,
06173 type3_
06174 >,
06175 true,
06176 true,
06177 false,
06178 false
06179 >
06180 {
06181 public:
06182 typedef pack<
06183 type0_,
06184 type1_,
06185 type2_,
06186 type3_
06187 > input_pack_type;
06188
06189 typedef pack<
06190 type0_,
06191 type1_
06192 > type;
06193
06194 static LITE_INLINE void set(
06195 type& res,
06196 const typename input_pack_type::type0& a0,
06197 const typename input_pack_type::type1& a1,
06198 const typename input_pack_type::type2& ,
06199 const typename input_pack_type::type3&
06200 )
06201 {
06202 res.set(a0,a1);
06203 }
06204
06205 static LITE_INLINE void set(type& res, const input_pack_type& org)
06206 {
06207 res.set(org.i0,org.i1);
06208 LITE_ARRAY_USE(org);
06209 }
06210 };
06211
06212
06213
06214 template<
06215 typename type0_,
06216 typename type1_,
06217 typename type2_,
06218 typename type3_
06219 >
06220 class sub_pack<
06221 pack<
06222 type0_,
06223 type1_,
06224 type2_,
06225 type3_
06226 >,
06227 false,
06228 false,
06229 true,
06230 false
06231 >
06232 {
06233 public:
06234 typedef pack<
06235 type0_,
06236 type1_,
06237 type2_,
06238 type3_
06239 > input_pack_type;
06240
06241 typedef pack<
06242 type2_
06243 > type;
06244
06245 static LITE_INLINE void set(
06246 type& res,
06247 const typename input_pack_type::type0& ,
06248 const typename input_pack_type::type1& ,
06249 const typename input_pack_type::type2& a2,
06250 const typename input_pack_type::type3&
06251 )
06252 {
06253 res.set(a2);
06254 }
06255
06256 static LITE_INLINE void set(type& res, const input_pack_type& org)
06257 {
06258 res.set(org.i2);
06259 LITE_ARRAY_USE(org);
06260 }
06261 };
06262
06263
06264
06265 template<
06266 typename type0_,
06267 typename type1_,
06268 typename type2_,
06269 typename type3_
06270 >
06271 class sub_pack<
06272 pack<
06273 type0_,
06274 type1_,
06275 type2_,
06276 type3_
06277 >,
06278 true,
06279 false,
06280 true,
06281 false
06282 >
06283 {
06284 public:
06285 typedef pack<
06286 type0_,
06287 type1_,
06288 type2_,
06289 type3_
06290 > input_pack_type;
06291
06292 typedef pack<
06293 type0_,
06294 type2_
06295 > type;
06296
06297 static LITE_INLINE void set(
06298 type& res,
06299 const typename input_pack_type::type0& a0,
06300 const typename input_pack_type::type1& ,
06301 const typename input_pack_type::type2& a2,
06302 const typename input_pack_type::type3&
06303 )
06304 {
06305 res.set(a0,a2);
06306 }
06307
06308 static LITE_INLINE void set(type& res, const input_pack_type& org)
06309 {
06310 res.set(org.i0,org.i2);
06311 LITE_ARRAY_USE(org);
06312 }
06313 };
06314
06315
06316
06317 template<
06318 typename type0_,
06319 typename type1_,
06320 typename type2_,
06321 typename type3_
06322 >
06323 class sub_pack<
06324 pack<
06325 type0_,
06326 type1_,
06327 type2_,
06328 type3_
06329 >,
06330 false,
06331 true,
06332 true,
06333 false
06334 >
06335 {
06336 public:
06337 typedef pack<
06338 type0_,
06339 type1_,
06340 type2_,
06341 type3_
06342 > input_pack_type;
06343
06344 typedef pack<
06345 type1_,
06346 type2_
06347 > type;
06348
06349 static LITE_INLINE void set(
06350 type& res,
06351 const typename input_pack_type::type0& ,
06352 const typename input_pack_type::type1& a1,
06353 const typename input_pack_type::type2& a2,
06354 const typename input_pack_type::type3&
06355 )
06356 {
06357 res.set(a1,a2);
06358 }
06359
06360 static LITE_INLINE void set(type& res, const input_pack_type& org)
06361 {
06362 res.set(org.i1,org.i2);
06363 LITE_ARRAY_USE(org);
06364 }
06365 };
06366
06367
06368
06369 template<
06370 typename type0_,
06371 typename type1_,
06372 typename type2_,
06373 typename type3_
06374 >
06375 class sub_pack<
06376 pack<
06377 type0_,
06378 type1_,
06379 type2_,
06380 type3_
06381 >,
06382 true,
06383 true,
06384 true,
06385 false
06386 >
06387 {
06388 public:
06389 typedef pack<
06390 type0_,
06391 type1_,
06392 type2_,
06393 type3_
06394 > input_pack_type;
06395
06396 typedef pack<
06397 type0_,
06398 type1_,
06399 type2_
06400 > type;
06401
06402 static LITE_INLINE void set(
06403 type& res,
06404 const typename input_pack_type::type0& a0,
06405 const typename input_pack_type::type1& a1,
06406 const typename input_pack_type::type2& a2,
06407 const typename input_pack_type::type3&
06408 )
06409 {
06410 res.set(a0,a1,a2);
06411 }
06412
06413 static LITE_INLINE void set(type& res, const input_pack_type& org)
06414 {
06415 res.set(org.i0,org.i1,org.i2);
06416 LITE_ARRAY_USE(org);
06417 }
06418 };
06419
06420
06421
06422 template<
06423 typename type0_,
06424 typename type1_,
06425 typename type2_,
06426 typename type3_
06427 >
06428 class sub_pack<
06429 pack<
06430 type0_,
06431 type1_,
06432 type2_,
06433 type3_
06434 >,
06435 false,
06436 false,
06437 false,
06438 true
06439 >
06440 {
06441 public:
06442 typedef pack<
06443 type0_,
06444 type1_,
06445 type2_,
06446 type3_
06447 > input_pack_type;
06448
06449 typedef pack<
06450 type3_
06451 > type;
06452
06453 static LITE_INLINE void set(
06454 type& res,
06455 const typename input_pack_type::type0& ,
06456 const typename input_pack_type::type1& ,
06457 const typename input_pack_type::type2& ,
06458 const typename input_pack_type::type3& a3
06459 )
06460 {
06461 res.set(a3);
06462 }
06463
06464 static LITE_INLINE void set(type& res, const input_pack_type& org)
06465 {
06466 res.set(org.i3);
06467 LITE_ARRAY_USE(org);
06468 }
06469 };
06470
06471
06472
06473 template<
06474 typename type0_,
06475 typename type1_,
06476 typename type2_,
06477 typename type3_
06478 >
06479 class sub_pack<
06480 pack<
06481 type0_,
06482 type1_,
06483 type2_,
06484 type3_
06485 >,
06486 true,
06487 false,
06488 false,
06489 true
06490 >
06491 {
06492 public:
06493 typedef pack<
06494 type0_,
06495 type1_,
06496 type2_,
06497 type3_
06498 > input_pack_type;
06499
06500 typedef pack<
06501 type0_,
06502 type3_
06503 > type;
06504
06505 static LITE_INLINE void set(
06506 type& res,
06507 const typename input_pack_type::type0& a0,
06508 const typename input_pack_type::type1& ,
06509 const typename input_pack_type::type2& ,
06510 const typename input_pack_type::type3& a3
06511 )
06512 {
06513 res.set(a0,a3);
06514 }
06515
06516 static LITE_INLINE void set(type& res, const input_pack_type& org)
06517 {
06518 res.set(org.i0,org.i3);
06519 LITE_ARRAY_USE(org);
06520 }
06521 };
06522
06523
06524
06525 template<
06526 typename type0_,
06527 typename type1_,
06528 typename type2_,
06529 typename type3_
06530 >
06531 class sub_pack<
06532 pack<
06533 type0_,
06534 type1_,
06535 type2_,
06536 type3_
06537 >,
06538 false,
06539 true,
06540 false,
06541 true
06542 >
06543 {
06544 public:
06545 typedef pack<
06546 type0_,
06547 type1_,
06548 type2_,
06549 type3_
06550 > input_pack_type;
06551
06552 typedef pack<
06553 type1_,
06554 type3_
06555 > type;
06556
06557 static LITE_INLINE void set(
06558 type& res,
06559 const typename input_pack_type::type0& ,
06560 const typename input_pack_type::type1& a1,
06561 const typename input_pack_type::type2& ,
06562 const typename input_pack_type::type3& a3
06563 )
06564 {
06565 res.set(a1,a3);
06566 }
06567
06568 static LITE_INLINE void set(type& res, const input_pack_type& org)
06569 {
06570 res.set(org.i1,org.i3);
06571 LITE_ARRAY_USE(org);
06572 }
06573 };
06574
06575
06576
06577 template<
06578 typename type0_,
06579 typename type1_,
06580 typename type2_,
06581 typename type3_
06582 >
06583 class sub_pack<
06584 pack<
06585 type0_,
06586 type1_,
06587 type2_,
06588 type3_
06589 >,
06590 true,
06591 true,
06592 false,
06593 true
06594 >
06595 {
06596 public:
06597 typedef pack<
06598 type0_,
06599 type1_,
06600 type2_,
06601 type3_
06602 > input_pack_type;
06603
06604 typedef pack<
06605 type0_,
06606 type1_,
06607 type3_
06608 > type;
06609
06610 static LITE_INLINE void set(
06611 type& res,
06612 const typename input_pack_type::type0& a0,
06613 const typename input_pack_type::type1& a1,
06614 const typename input_pack_type::type2& ,
06615 const typename input_pack_type::type3& a3
06616 )
06617 {
06618 res.set(a0,a1,a3);
06619 }
06620
06621 static LITE_INLINE void set(type& res, const input_pack_type& org)
06622 {
06623 res.set(org.i0,org.i1,org.i3);
06624 LITE_ARRAY_USE(org);
06625 }
06626 };
06627
06628
06629
06630 template<
06631 typename type0_,
06632 typename type1_,
06633 typename type2_,
06634 typename type3_
06635 >
06636 class sub_pack<
06637 pack<
06638 type0_,
06639 type1_,
06640 type2_,
06641 type3_
06642 >,
06643 false,
06644 false,
06645 true,
06646 true
06647 >
06648 {
06649 public:
06650 typedef pack<
06651 type0_,
06652 type1_,
06653 type2_,
06654 type3_
06655 > input_pack_type;
06656
06657 typedef pack<
06658 type2_,
06659 type3_
06660 > type;
06661
06662 static LITE_INLINE void set(
06663 type& res,
06664 const typename input_pack_type::type0& ,
06665 const typename input_pack_type::type1& ,
06666 const typename input_pack_type::type2& a2,
06667 const typename input_pack_type::type3& a3
06668 )
06669 {
06670 res.set(a2,a3);
06671 }
06672
06673 static LITE_INLINE void set(type& res, const input_pack_type& org)
06674 {
06675 res.set(org.i2,org.i3);
06676 LITE_ARRAY_USE(org);
06677 }
06678 };
06679
06680
06681
06682 template<
06683 typename type0_,
06684 typename type1_,
06685 typename type2_,
06686 typename type3_
06687 >
06688 class sub_pack<
06689 pack<
06690 type0_,
06691 type1_,
06692 type2_,
06693 type3_
06694 >,
06695 true,
06696 false,
06697 true,
06698 true
06699 >
06700 {
06701 public:
06702 typedef pack<
06703 type0_,
06704 type1_,
06705 type2_,
06706 type3_
06707 > input_pack_type;
06708
06709 typedef pack<
06710 type0_,
06711 type2_,
06712 type3_
06713 > type;
06714
06715 static LITE_INLINE void set(
06716 type& res,
06717 const typename input_pack_type::type0& a0,
06718 const typename input_pack_type::type1& ,
06719 const typename input_pack_type::type2& a2,
06720 const typename input_pack_type::type3& a3
06721 )
06722 {
06723 res.set(a0,a2,a3);
06724 }
06725
06726 static LITE_INLINE void set(type& res, const input_pack_type& org)
06727 {
06728 res.set(org.i0,org.i2,org.i3);
06729 LITE_ARRAY_USE(org);
06730 }
06731 };
06732
06733
06734
06735 template<
06736 typename type0_,
06737 typename type1_,
06738 typename type2_,
06739 typename type3_
06740 >
06741 class sub_pack<
06742 pack<
06743 type0_,
06744 type1_,
06745 type2_,
06746 type3_
06747 >,
06748 false,
06749 true,
06750 true,
06751 true
06752 >
06753 {
06754 public:
06755 typedef pack<
06756 type0_,
06757 type1_,
06758 type2_,
06759 type3_
06760 > input_pack_type;
06761
06762 typedef pack<
06763 type1_,
06764 type2_,
06765 type3_
06766 > type;
06767
06768 static LITE_INLINE void set(
06769 type& res,
06770 const typename input_pack_type::type0& ,
06771 const typename input_pack_type::type1& a1,
06772 const typename input_pack_type::type2& a2,
06773 const typename input_pack_type::type3& a3
06774 )
06775 {
06776 res.set(a1,a2,a3);
06777 }
06778
06779 static LITE_INLINE void set(type& res, const input_pack_type& org)
06780 {
06781 res.set(org.i1,org.i2,org.i3);
06782 LITE_ARRAY_USE(org);
06783 }
06784 };
06785
06786
06787
06788 template<
06789 typename type0_,
06790 typename type1_,
06791 typename type2_,
06792 typename type3_
06793 >
06794 class sub_pack<
06795 pack<
06796 type0_,
06797 type1_,
06798 type2_,
06799 type3_
06800 >,
06801 true,
06802 true,
06803 true,
06804 true
06805 >
06806 {
06807 public:
06808 typedef pack<
06809 type0_,
06810 type1_,
06811 type2_,
06812 type3_
06813 > input_pack_type;
06814
06815 typedef pack<
06816 type0_,
06817 type1_,
06818 type2_,
06819 type3_
06820 > type;
06821
06822 static LITE_INLINE void set(
06823 type& res,
06824 const typename input_pack_type::type0& a0,
06825 const typename input_pack_type::type1& a1,
06826 const typename input_pack_type::type2& a2,
06827 const typename input_pack_type::type3& a3
06828 )
06829 {
06830 res.set(a0,a1,a2,a3);
06831 }
06832
06833 static LITE_INLINE void set(type& res, const input_pack_type& org)
06834 {
06835 res.set(org.i0,org.i1,org.i2,org.i3);
06836 LITE_ARRAY_USE(org);
06837 }
06838 };
06839
06840
06841
06842 #endif // !DOCUMENTATION_ONLY
06843
06844
06845
06846
06847
06848 #ifdef DOCUMENTATION_ONLY
06849
06870 template<int index_, typename type_>
06871 struct get_type
06872 {
06873 typedef ... type;
06874 };
06875
06876 #else // DOCUMENTATION_ONLY
06877
06878
06879 template<int index_, typename type_>
06880 struct get_type;
06881
06882 template<typename type_>
06883 struct get_type<0, type_>
06884 {
06885 typedef typename type_::type0 type;
06886 };
06887 template<typename type_>
06888 struct get_type<1, type_>
06889 {
06890 typedef typename type_::type1 type;
06891 };
06892 template<typename type_>
06893 struct get_type<2, type_>
06894 {
06895 typedef typename type_::type2 type;
06896 };
06897 template<typename type_>
06898 struct get_type<3, type_>
06899 {
06900 typedef typename type_::type3 type;
06901 };
06902
06903 #endif // !DOCUMENTATION_ONLY
06904
06905
06906
06907
06908
06909 #ifdef DOCUMENTATION_ONLY
06910
06928 template<int index_, typename type_>
06929 typename get_type<index_, type_>::type get(const type_& a);
06930
06931 #else // DOCUMENTATION_ONLY
06932
06933 template<int index_, typename type_>
06934 LITE_INLINE
06935 typename detail::enable_if<index_==0, typename get_type<index_, type_>::type>::type
06936 get(const type_& a)
06937 {
06938 LITE_ARRAY_USE(a);
06939 return a.i0;
06940 };
06941
06942 template<int index_, typename type_>
06943 LITE_INLINE
06944 typename detail::enable_if<index_==1, typename get_type<index_, type_>::type>::type
06945 get(const type_& a)
06946 {
06947 LITE_ARRAY_USE(a);
06948 return a.i1;
06949 };
06950
06951 template<int index_, typename type_>
06952 LITE_INLINE
06953 typename detail::enable_if<index_==2, typename get_type<index_, type_>::type>::type
06954 get(const type_& a)
06955 {
06956 LITE_ARRAY_USE(a);
06957 return a.i2;
06958 };
06959
06960 template<int index_, typename type_>
06961 LITE_INLINE
06962 typename detail::enable_if<index_==3, typename get_type<index_, type_>::type>::type
06963 get(const type_& a)
06964 {
06965 LITE_ARRAY_USE(a);
06966 return a.i3;
06967 };
06968
06969
06970 #endif // DOCUMENTATION_ONLY
06971
06972
06973
06974
06975 #ifdef DOCUMENTATION_ONLY
06976
06997 template<int index_, typename type_, typename value_type_>
06998 void set(type_& a, const value_type_& v);
06999
07000 #else // DOCUMENTATION_ONLY
07001
07002
07003 template<int index_, typename type_, typename value_type_>
07004 LITE_INLINE
07005 typename detail::enable_if<index_==0 && type_::is_const0>::type
07006 set(type_&, const value_type_&)
07007 {}
07008
07009 template<int index_, typename type_, typename value_type_>
07010 LITE_INLINE
07011 typename detail::enable_if<index_==0 && !type_::is_const0>::type
07012 set(type_& a, const value_type_& v)
07013 {
07014 a.i0 = v;
07015 }
07016
07017 template<int index_, typename type_, typename value_type_>
07018 LITE_INLINE
07019 typename detail::enable_if<index_==1 && type_::is_const1>::type
07020 set(type_&, const value_type_&)
07021 {}
07022
07023 template<int index_, typename type_, typename value_type_>
07024 LITE_INLINE
07025 typename detail::enable_if<index_==1 && !type_::is_const1>::type
07026 set(type_& a, const value_type_& v)
07027 {
07028 a.i1 = v;
07029 }
07030
07031 template<int index_, typename type_, typename value_type_>
07032 LITE_INLINE
07033 typename detail::enable_if<index_==2 && type_::is_const2>::type
07034 set(type_&, const value_type_&)
07035 {}
07036
07037 template<int index_, typename type_, typename value_type_>
07038 LITE_INLINE
07039 typename detail::enable_if<index_==2 && !type_::is_const2>::type
07040 set(type_& a, const value_type_& v)
07041 {
07042 a.i2 = v;
07043 }
07044
07045 template<int index_, typename type_, typename value_type_>
07046 LITE_INLINE
07047 typename detail::enable_if<index_==3 && type_::is_const3>::type
07048 set(type_&, const value_type_&)
07049 {}
07050
07051 template<int index_, typename type_, typename value_type_>
07052 LITE_INLINE
07053 typename detail::enable_if<index_==3 && !type_::is_const3>::type
07054 set(type_& a, const value_type_& v)
07055 {
07056 a.i3 = v;
07057 }
07058
07059 #endif // DOCUMENTATION_ONLY
07060
07061
07062
07063 #ifdef DOCUMENTATION_ONLY
07064
07069 template<typename l_type0_, ..., typename l_typeN_, typename r_type0_, ..., typename r_typeN_>
07070 bool operator<(const pack<l_type0_, ..., l_typeN_>&a, const pack<r_type0_, ..., r_typeN_>& b);
07071 #endif // DOCUMENTATION_ONLY
07072
07073 LITE_INLINE
07074 bool operator<(const pack<>&, const pack<>&)
07075 {
07076 return false;
07077 }
07078
07079 template<
07080 typename l_type0_,
07081 typename r_type0_
07082 >
07083 LITE_INLINE
07084 bool operator<(
07085 const pack<l_type0_>& a,
07086 const pack<r_type0_>& b)
07087 {
07088 return a.i0<b.i0;
07089 LITE_ARRAY_USE(a);
07090 LITE_ARRAY_USE(b);
07091 }
07092
07093 template<
07094 typename l_type0_,
07095 typename l_type1_,
07096 typename r_type0_,
07097 typename r_type1_
07098 >
07099 LITE_INLINE
07100 bool operator<(
07101 const pack<l_type0_, l_type1_>& a,
07102 const pack<r_type0_, r_type1_>& b)
07103 {
07104 return a.i0<b.i0 && a.i1<b.i1;
07105 LITE_ARRAY_USE(a);
07106 LITE_ARRAY_USE(b);
07107 }
07108
07109 template<
07110 typename l_type0_,
07111 typename l_type1_,
07112 typename l_type2_,
07113 typename r_type0_,
07114 typename r_type1_,
07115 typename r_type2_
07116 >
07117 LITE_INLINE
07118 bool operator<(
07119 const pack<l_type0_, l_type1_, l_type2_>& a,
07120 const pack<r_type0_, r_type1_, r_type2_>& b)
07121 {
07122 return a.i0<b.i0 && a.i1<b.i1 && a.i2<b.i2;
07123 LITE_ARRAY_USE(a);
07124 LITE_ARRAY_USE(b);
07125 }
07126
07127
07128
07129
07130 #ifdef DOCUMENTATION_ONLY
07131
07136 template<typename l_type0_, ..., typename l_typeN_, typename r_type0_, ..., typename r_typeN_>
07137 bool operator<=(const pack<l_type0_, ..., l_typeN_>&a, const pack<r_type0_, ..., r_typeN_>& b);
07138 #endif // DOCUMENTATION_ONLY
07139
07140 LITE_INLINE
07141 bool operator<=(const pack<>&, const pack<>&)
07142 {
07143 return true;
07144 }
07145
07146 template<
07147 typename l_type0_,
07148 typename r_type0_
07149 >
07150 LITE_INLINE
07151 bool operator<=(
07152 const pack<l_type0_>& a,
07153 const pack<r_type0_>& b)
07154 {
07155 return a.i0<=b.i0;
07156 LITE_ARRAY_USE(a);
07157 LITE_ARRAY_USE(b);
07158 }
07159
07160 template<
07161 typename l_type0_,
07162 typename l_type1_,
07163 typename r_type0_,
07164 typename r_type1_
07165 >
07166 LITE_INLINE
07167 bool operator<=(
07168 const pack<l_type0_, l_type1_>& a,
07169 const pack<r_type0_, r_type1_>& b)
07170 {
07171 return a.i0<=b.i0 && a.i1<=b.i1;
07172 LITE_ARRAY_USE(a);
07173 LITE_ARRAY_USE(b);
07174 }
07175
07176 template<
07177 typename l_type0_,
07178 typename l_type1_,
07179 typename l_type2_,
07180 typename r_type0_,
07181 typename r_type1_,
07182 typename r_type2_
07183 >
07184 LITE_INLINE
07185 bool operator<=(
07186 const pack<l_type0_, l_type1_, l_type2_>& a,
07187 const pack<r_type0_, r_type1_, r_type2_>& b)
07188 {
07189 return a.i0<=b.i0 && a.i1<=b.i1 && a.i2<=b.i2;
07190 LITE_ARRAY_USE(a);
07191 LITE_ARRAY_USE(b);
07192 }
07193
07194
07195
07196
07197 #ifdef DOCUMENTATION_ONLY
07198
07203 template<typename l_type0_, ..., typename l_typeN_, typename r_type0_, ..., typename r_typeN_>
07204 bool operator==(const pack<l_type0_, ..., l_typeN_>&a, const pack<r_type0_, ..., r_typeN_>& b);
07205 #endif // DOCUMENTATION_ONLY
07206
07207 LITE_INLINE
07208 bool operator==(const pack<>&, const pack<>&)
07209 {
07210 return true;
07211 }
07212
07213 template<
07214 typename l_type0_,
07215 typename r_type0_
07216 >
07217 LITE_INLINE
07218 bool operator==(
07219 const pack<l_type0_>& a,
07220 const pack<r_type0_>& b)
07221 {
07222 return a.i0==b.i0;
07223 LITE_ARRAY_USE(a);
07224 LITE_ARRAY_USE(b);
07225 }
07226
07227 template<
07228 typename l_type0_,
07229 typename l_type1_,
07230 typename r_type0_,
07231 typename r_type1_
07232 >
07233 LITE_INLINE
07234 bool operator==(
07235 const pack<l_type0_, l_type1_>& a,
07236 const pack<r_type0_, r_type1_>& b)
07237 {
07238 return a.i0==b.i0 && a.i1==b.i1;
07239 LITE_ARRAY_USE(a);
07240 LITE_ARRAY_USE(b);
07241 }
07242
07243 template<
07244 typename l_type0_,
07245 typename l_type1_,
07246 typename l_type2_,
07247 typename r_type0_,
07248 typename r_type1_,
07249 typename r_type2_
07250 >
07251 LITE_INLINE
07252 bool operator==(
07253 const pack<l_type0_, l_type1_, l_type2_>& a,
07254 const pack<r_type0_, r_type1_, r_type2_>& b)
07255 {
07256 return a.i0==b.i0 && a.i1==b.i1 && a.i2==b.i2;
07257 LITE_ARRAY_USE(a);
07258 LITE_ARRAY_USE(b);
07259 }
07260
07261
07262
07263
07264 #ifdef DOCUMENTATION_ONLY
07265
07270 template<typename l_type0_, ..., typename l_typeN_, typename r_type0_, ..., typename r_typeN_>
07271 bool operator>=(const pack<l_type0_, ..., l_typeN_>&a, const pack<r_type0_, ..., r_typeN_>& b);
07272 #endif // DOCUMENTATION_ONLY
07273
07274 LITE_INLINE
07275 bool operator>=(const pack<>&, const pack<>&)
07276 {
07277 return true;
07278 }
07279
07280 template<
07281 typename l_type0_,
07282 typename r_type0_
07283 >
07284 LITE_INLINE
07285 bool operator>=(
07286 const pack<l_type0_>& a,
07287 const pack<r_type0_>& b)
07288 {
07289 return a.i0>=b.i0;
07290 LITE_ARRAY_USE(a);
07291 LITE_ARRAY_USE(b);
07292 }
07293
07294 template<
07295 typename l_type0_,
07296 typename l_type1_,
07297 typename r_type0_,
07298 typename r_type1_
07299 >
07300 LITE_INLINE
07301 bool operator>=(
07302 const pack<l_type0_, l_type1_>& a,
07303 const pack<r_type0_, r_type1_>& b)
07304 {
07305 return a.i0>=b.i0 && a.i1>=b.i1;
07306 LITE_ARRAY_USE(a);
07307 LITE_ARRAY_USE(b);
07308 }
07309
07310 template<
07311 typename l_type0_,
07312 typename l_type1_,
07313 typename l_type2_,
07314 typename r_type0_,
07315 typename r_type1_,
07316 typename r_type2_
07317 >
07318 LITE_INLINE
07319 bool operator>=(
07320 const pack<l_type0_, l_type1_, l_type2_>& a,
07321 const pack<r_type0_, r_type1_, r_type2_>& b)
07322 {
07323 return a.i0>=b.i0 && a.i1>=b.i1 && a.i2>=b.i2;
07324 LITE_ARRAY_USE(a);
07325 LITE_ARRAY_USE(b);
07326 }
07327
07328
07329
07330
07331 #ifdef DOCUMENTATION_ONLY
07332
07337 template<typename l_type0_, ..., typename l_typeN_, typename r_type0_, ..., typename r_typeN_>
07338 bool operator>(const pack<l_type0_, ..., l_typeN_>&a, const pack<r_type0_, ..., r_typeN_>& b);
07339 #endif // DOCUMENTATION_ONLY
07340
07341 LITE_INLINE
07342 bool operator>(const pack<>&, const pack<>&)
07343 {
07344 return false;
07345 }
07346
07347 template<
07348 typename l_type0_,
07349 typename r_type0_
07350 >
07351 LITE_INLINE
07352 bool operator>(
07353 const pack<l_type0_>& a,
07354 const pack<r_type0_>& b)
07355 {
07356 return a.i0>b.i0;
07357 LITE_ARRAY_USE(a);
07358 LITE_ARRAY_USE(b);
07359 }
07360
07361 template<
07362 typename l_type0_,
07363 typename l_type1_,
07364 typename r_type0_,
07365 typename r_type1_
07366 >
07367 LITE_INLINE
07368 bool operator>(
07369 const pack<l_type0_, l_type1_>& a,
07370 const pack<r_type0_, r_type1_>& b)
07371 {
07372 return a.i0>b.i0 && a.i1>b.i1;
07373 LITE_ARRAY_USE(a);
07374 LITE_ARRAY_USE(b);
07375 }
07376
07377 template<
07378 typename l_type0_,
07379 typename l_type1_,
07380 typename l_type2_,
07381 typename r_type0_,
07382 typename r_type1_,
07383 typename r_type2_
07384 >
07385 LITE_INLINE
07386 bool operator>(
07387 const pack<l_type0_, l_type1_, l_type2_>& a,
07388 const pack<r_type0_, r_type1_, r_type2_>& b)
07389 {
07390 return a.i0>b.i0 && a.i1>b.i1 && a.i2>b.i2;
07391 LITE_ARRAY_USE(a);
07392 LITE_ARRAY_USE(b);
07393 }
07394
07395
07396
07397
07398
07399
07400 #ifdef DOCUMENTATION_ONLY
07401
07407 template<typename l_type0_, ..., typename l_typeN_, typename r_type0_, ..., typename r_typeN_>
07408 bool operator!=(const pack<l_type0_, ..., l_typeN_>&a, const pack<r_type0_, ..., r_typeN_>& b);
07409
07410 #else // DOCUMENTATION_ONLY
07411
07412 LITE_INLINE
07413 bool operator!=(const pack<>&, const pack<>&)
07414 {
07415 return false;
07416 }
07417
07418 template<
07419 typename l_type0_,
07420 typename r_type0_
07421 >
07422 LITE_INLINE
07423 bool operator!=(
07424 const pack<l_type0_>& a,
07425 const pack<r_type0_>& b)
07426 {
07427 return !(a==b);
07428 }
07429
07430 template<
07431 typename l_type0_,
07432 typename l_type1_,
07433 typename r_type0_,
07434 typename r_type1_
07435 >
07436 LITE_INLINE
07437 bool operator!=(
07438 const pack<l_type0_,l_type1_>& a,
07439 const pack<r_type0_,r_type1_>& b)
07440 {
07441 return !(a==b);
07442 }
07443
07444 template<
07445 typename l_type0_,
07446 typename l_type1_,
07447 typename l_type2_,
07448 typename r_type0_,
07449 typename r_type1_,
07450 typename r_type2_
07451 >
07452 LITE_INLINE
07453 bool operator!=(
07454 const pack<l_type0_,l_type1_,l_type2_>& a,
07455 const pack<r_type0_,r_type1_,r_type2_>& b)
07456 {
07457 return !(a==b);
07458 }
07459
07460
07461 #endif // !DOCUMENTATION_ONLY
07462
07463
07464
07465
07466 #ifdef DOCUMENTATION_ONLY
07467
07490 template<typename char_type_, typename traits_type_, typename type0_, ..., typename typeN_>
07491 std::basic_ostream<char_type_, traits_type_>&
07492 operator<<(
07493 std::basic_ostream<char_type_, traits_type_>& os,
07494 const pack<type0_, ..., typeN_>& p);
07495
07496 #else // DOCUMENTATION_ONLY
07497
07498
07499 template<
07500 typename char_type_,
07501 typename traits_type_
07502 >
07503 std::basic_ostream<char_type_, traits_type_>&
07504 operator<<(
07505 std::basic_ostream<char_type_, traits_type_>& os,
07506 const pack<>& p)
07507 {
07508 std::streamsize width = os.width();
07509 bool punct = (os.flags() & std::ios_base::boolalpha) != 0;
07510
07511 os.width(0);
07512
07513 if (punct)
07514 os << '[';
07515
07516
07517 if (punct)
07518 os << ']';
07519 return os;
07520
07521 LITE_ARRAY_USE(p);
07522 }
07523
07524
07525 template<
07526 typename char_type_,
07527 typename traits_type_,
07528 typename type0_
07529 >
07530 std::basic_ostream<char_type_, traits_type_>&
07531 operator<<(
07532 std::basic_ostream<char_type_, traits_type_>& os,
07533 const pack<type0_>& p)
07534 {
07535 std::streamsize width = os.width();
07536 bool punct = (os.flags() & std::ios_base::boolalpha) != 0;
07537
07538 os.width(0);
07539
07540 if (punct)
07541 os << '[';
07542
07543 os.width(width); os << p.i0;
07544
07545 if (punct)
07546 os << ']';
07547 return os;
07548
07549 LITE_ARRAY_USE(p);
07550 }
07551
07552
07553 template<
07554 typename char_type_,
07555 typename traits_type_,
07556 typename type0_,
07557 typename type1_
07558 >
07559 std::basic_ostream<char_type_, traits_type_>&
07560 operator<<(
07561 std::basic_ostream<char_type_, traits_type_>& os,
07562 const pack<type0_,type1_>& p)
07563 {
07564 std::streamsize width = os.width();
07565 bool punct = (os.flags() & std::ios_base::boolalpha) != 0;
07566
07567 os.width(0);
07568
07569 if (punct)
07570 os << '[';
07571
07572 os.width(width); os << p.i0; os << ' ';
07573 os.width(width); os << p.i1;
07574
07575 if (punct)
07576 os << ']';
07577 return os;
07578
07579 LITE_ARRAY_USE(p);
07580 }
07581
07582
07583 template<
07584 typename char_type_,
07585 typename traits_type_,
07586 typename type0_,
07587 typename type1_,
07588 typename type2_
07589 >
07590 std::basic_ostream<char_type_, traits_type_>&
07591 operator<<(
07592 std::basic_ostream<char_type_, traits_type_>& os,
07593 const pack<type0_,type1_,type2_>& p)
07594 {
07595 std::streamsize width = os.width();
07596 bool punct = (os.flags() & std::ios_base::boolalpha) != 0;
07597
07598 os.width(0);
07599
07600 if (punct)
07601 os << '[';
07602
07603 os.width(width); os << p.i0; os << ' ';
07604 os.width(width); os << p.i1; os << ' ';
07605 os.width(width); os << p.i2;
07606
07607 if (punct)
07608 os << ']';
07609 return os;
07610
07611 LITE_ARRAY_USE(p);
07612 }
07613
07614
07615 template<
07616 typename char_type_,
07617 typename traits_type_,
07618 typename type0_,
07619 typename type1_,
07620 typename type2_,
07621 typename type3_
07622 >
07623 std::basic_ostream<char_type_, traits_type_>&
07624 operator<<(
07625 std::basic_ostream<char_type_, traits_type_>& os,
07626 const pack<type0_,type1_,type2_,type3_>& p)
07627 {
07628 std::streamsize width = os.width();
07629 bool punct = (os.flags() & std::ios_base::boolalpha) != 0;
07630
07631 os.width(0);
07632
07633 if (punct)
07634 os << '[';
07635
07636 os.width(width); os << p.i0; os << ' ';
07637 os.width(width); os << p.i1; os << ' ';
07638 os.width(width); os << p.i2; os << ' ';
07639 os.width(width); os << p.i3;
07640
07641 if (punct)
07642 os << ']';
07643 return os;
07644
07645 LITE_ARRAY_USE(p);
07646 }
07647
07648
07649 #endif // !DOCUMENTATION_ONLY
07650
07651
07652
07653
07654 #ifdef DOCUMENTATION_ONLY
07655
07681 template<typename char_type_, typename traits_type_, typename type0_, ..., typename typeN_>
07682 std::basic_istream<char_type_, traits_type_>&
07683 operator>>(
07684 std::basic_istream<char_type_, traits_type_>& is,
07685 pack<type0_, ..., typeN_>& p);
07686
07687 #else // DOCUMENTATION_ONLY
07688
07689
07690 template<
07691 typename char_type_,
07692 typename traits_type_
07693 >
07694 std::basic_istream<char_type_, traits_type_>&
07695 operator>>(
07696 std::basic_ostream<char_type_, traits_type_>& is,
07697 pack<>& p)
07698 {
07699 char_type_ ch;
07700
07701 if (!(is >> ch))
07702 return is;
07703
07704 bool fancy = is.narrow(ch, '\0') == '[';
07705
07706 if (!fancy)
07707 is.putback(ch);
07708
07709
07710 ch = char_type_();
07711 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
07712 is.setstate(std::ios_base::failbit);
07713 return is;
07714 }
07715
07716 p.set();
07717 return is;
07718 LITE_ARRAY_USE(p);
07719 }
07720
07721
07722 template<
07723 typename char_type_,
07724 typename traits_type_,
07725 typename type0_
07726 >
07727 std::basic_istream<char_type_, traits_type_>&
07728 operator>>(
07729 std::basic_ostream<char_type_, traits_type_>& is,
07730 pack<type0_>& p)
07731 {
07732 char_type_ ch;
07733
07734 if (!(is >> ch))
07735 return is;
07736
07737 bool fancy = is.narrow(ch, '\0') == '[';
07738
07739 if (!fancy)
07740 is.putback(ch);
07741
07742 type0_ i0; is >> i0;
07743
07744 ch = char_type_();
07745 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
07746 is.setstate(std::ios_base::failbit);
07747 return is;
07748 }
07749
07750 p.set(i0);
07751 return is;
07752 }
07753
07754
07755 template<
07756 typename char_type_,
07757 typename traits_type_,
07758 typename type0_,
07759 typename type1_
07760 >
07761 std::basic_istream<char_type_, traits_type_>&
07762 operator>>(
07763 std::basic_ostream<char_type_, traits_type_>& is,
07764 pack<type0_,type1_>& p)
07765 {
07766 char_type_ ch;
07767
07768 if (!(is >> ch))
07769 return is;
07770
07771 bool fancy = is.narrow(ch, '\0') == '[';
07772
07773 if (!fancy)
07774 is.putback(ch);
07775
07776 type0_ i0; is >> i0;
07777 type1_ i1; is >> i1;
07778
07779 ch = char_type_();
07780 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
07781 is.setstate(std::ios_base::failbit);
07782 return is;
07783 }
07784
07785 p.set(i0, i1);
07786 return is;
07787 }
07788
07789
07790 template<
07791 typename char_type_,
07792 typename traits_type_,
07793 typename type0_,
07794 typename type1_,
07795 typename type2_
07796 >
07797 std::basic_istream<char_type_, traits_type_>&
07798 operator>>(
07799 std::basic_ostream<char_type_, traits_type_>& is,
07800 pack<type0_,type1_,type2_>& p)
07801 {
07802 char_type_ ch;
07803
07804 if (!(is >> ch))
07805 return is;
07806
07807 bool fancy = is.narrow(ch, '\0') == '[';
07808
07809 if (!fancy)
07810 is.putback(ch);
07811
07812 type0_ i0; is >> i0;
07813 type1_ i1; is >> i1;
07814 type2_ i2; is >> i2;
07815
07816 ch = char_type_();
07817 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
07818 is.setstate(std::ios_base::failbit);
07819 return is;
07820 }
07821
07822 p.set(i0, i1, i2);
07823 return is;
07824 }
07825
07826
07827 template<
07828 typename char_type_,
07829 typename traits_type_,
07830 typename type0_,
07831 typename type1_,
07832 typename type2_,
07833 typename type3_
07834 >
07835 std::basic_istream<char_type_, traits_type_>&
07836 operator>>(
07837 std::basic_ostream<char_type_, traits_type_>& is,
07838 pack<type0_,type1_,type2_,type3_>& p)
07839 {
07840 char_type_ ch;
07841
07842 if (!(is >> ch))
07843 return is;
07844
07845 bool fancy = is.narrow(ch, '\0') == '[';
07846
07847 if (!fancy)
07848 is.putback(ch);
07849
07850 type0_ i0; is >> i0;
07851 type1_ i1; is >> i1;
07852 type2_ i2; is >> i2;
07853 type3_ i3; is >> i3;
07854
07855 ch = char_type_();
07856 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
07857 is.setstate(std::ios_base::failbit);
07858 return is;
07859 }
07860
07861 p.set(i0, i1, i2, i3);
07862 return is;
07863 }
07864
07865
07866 #endif // !DOCUMENTATION_ONLY
07867
07868
07869
07870
07871
07876 template<typename left_size_type_, typename right_size_type_>
07877 void lite_array_size_check(const left_size_type_& a, const right_size_type_& b, const std::string& msg)
07878 {
07879 if (a != b)
07880 throw size_mismatch_error(msg);
07881 }
07882
07883 }
07884
07885
07886
07887
07888
07889 namespace std
07890 {
07891 template<
07892 typename type0_,
07893 typename type1_,
07894 typename type2_,
07895 typename type3_
07896 >
07897 struct iterator_traits<lite::pack<
07898 type0_,
07899 type1_,
07900 type2_,
07901 type3_
07902 > >
07903 : public iterator_traits<type0_>
07904 {};
07905 }
07906
07907 namespace lite
07908 {
07909
07910
07911
07912
07913
07951
07952
07953
07954
07955 template<
07956 typename iter_type_
07957 >
07958 LITE_INLINE
07959 typename std::iterator_traits<pack<
07960 iter_type_
07961 > >::reference
07962 at(const pack<
07963 iter_type_
07964 >& it
07965 )
07966 {
07967 return *(it.i0);
07968 }
07969 template<
07970 typename iter_type_,
07971 typename ind_type0_
07972 >
07973 LITE_INLINE
07974 typename std::iterator_traits<pack<
07975 iter_type_,
07976 ind_type0_
07977 > >::reference
07978 at(const pack<
07979 iter_type_,
07980 ind_type0_
07981 >& it
07982 )
07983 {
07984 return *(it.i0);
07985 }
07986 template<
07987 typename iter_type_,
07988 typename ind_type0_
07989 >
07990 LITE_INLINE
07991 typename std::iterator_traits<pack<
07992 iter_type_,
07993 ind_type0_
07994 > >::reference
07995 at(const pack<
07996 iter_type_,
07997 ind_type0_
07998 >& it,
07999 int ind0
08000 )
08001 {
08002 return *(it.i0+ind0*it.i1);
08003 }
08004 template<
08005 typename iter_type_,
08006 typename ind_type0_,
08007 typename ind_type1_
08008 >
08009 LITE_INLINE
08010 typename std::iterator_traits<pack<
08011 iter_type_,
08012 ind_type0_,
08013 ind_type1_
08014 > >::reference
08015 at(const pack<
08016 iter_type_,
08017 ind_type0_,
08018 ind_type1_
08019 >& it
08020 )
08021 {
08022 return *(it.i0);
08023 }
08024 template<
08025 typename iter_type_,
08026 typename ind_type0_,
08027 typename ind_type1_
08028 >
08029 LITE_INLINE
08030 typename std::iterator_traits<pack<
08031 iter_type_,
08032 ind_type0_,
08033 ind_type1_
08034 > >::reference
08035 at(const pack<
08036 iter_type_,
08037 ind_type0_,
08038 ind_type1_
08039 >& it,
08040 int ind0
08041 )
08042 {
08043 return *(it.i0+ind0*it.i2);
08044 }
08045 template<
08046 typename iter_type_,
08047 typename ind_type0_,
08048 typename ind_type1_
08049 >
08050 LITE_INLINE
08051 typename std::iterator_traits<pack<
08052 iter_type_,
08053 ind_type0_,
08054 ind_type1_
08055 > >::reference
08056 at(const pack<
08057 iter_type_,
08058 ind_type0_,
08059 ind_type1_
08060 >& it,
08061 int ind0,
08062 int ind1
08063 )
08064 {
08065 return *(it.i0+ind0*it.i1+ind1*it.i2);
08066 }
08067 template<
08068 typename iter_type_,
08069 typename ind_type0_,
08070 typename ind_type1_,
08071 typename ind_type2_
08072 >
08073 LITE_INLINE
08074 typename std::iterator_traits<pack<
08075 iter_type_,
08076 ind_type0_,
08077 ind_type1_,
08078 ind_type2_
08079 > >::reference
08080 at(const pack<
08081 iter_type_,
08082 ind_type0_,
08083 ind_type1_,
08084 ind_type2_
08085 >& it
08086 )
08087 {
08088 return *(it.i0);
08089 }
08090 template<
08091 typename iter_type_,
08092 typename ind_type0_,
08093 typename ind_type1_,
08094 typename ind_type2_
08095 >
08096 LITE_INLINE
08097 typename std::iterator_traits<pack<
08098 iter_type_,
08099 ind_type0_,
08100 ind_type1_,
08101 ind_type2_
08102 > >::reference
08103 at(const pack<
08104 iter_type_,
08105 ind_type0_,
08106 ind_type1_,
08107 ind_type2_
08108 >& it,
08109 int ind0
08110 )
08111 {
08112 return *(it.i0+ind0*it.i3);
08113 }
08114 template<
08115 typename iter_type_,
08116 typename ind_type0_,
08117 typename ind_type1_,
08118 typename ind_type2_
08119 >
08120 LITE_INLINE
08121 typename std::iterator_traits<pack<
08122 iter_type_,
08123 ind_type0_,
08124 ind_type1_,
08125 ind_type2_
08126 > >::reference
08127 at(const pack<
08128 iter_type_,
08129 ind_type0_,
08130 ind_type1_,
08131 ind_type2_
08132 >& it,
08133 int ind0,
08134 int ind1
08135 )
08136 {
08137 return *(it.i0+ind0*it.i2+ind1*it.i3);
08138 }
08139 template<
08140 typename iter_type_,
08141 typename ind_type0_,
08142 typename ind_type1_,
08143 typename ind_type2_
08144 >
08145 LITE_INLINE
08146 typename std::iterator_traits<pack<
08147 iter_type_,
08148 ind_type0_,
08149 ind_type1_,
08150 ind_type2_
08151 > >::reference
08152 at(const pack<
08153 iter_type_,
08154 ind_type0_,
08155 ind_type1_,
08156 ind_type2_
08157 >& it,
08158 int ind0,
08159 int ind1,
08160 int ind2
08161 )
08162 {
08163 return *(it.i0+ind0*it.i1+ind1*it.i2+ind2*it.i3);
08164 }
08165
08166
08167
08168
08169
08170 template<
08171 int dim_,
08172 typename iter_type_,
08173 typename ind_type0_,
08174 typename ind_type1_,
08175 typename ind_type2_
08176 >
08177 LITE_INLINE
08178 typename detail::enable_if<dim_==0, void>::type
08179 inc(pack<
08180 iter_type_,
08181 ind_type0_,
08182 ind_type1_,
08183 ind_type2_
08184 >& it)
08185 {
08186 it.i0 += it.i1;
08187 }
08188
08189 template<
08190 int dim_,
08191 typename iter_type_,
08192 typename ind_type0_,
08193 typename ind_type1_,
08194 typename ind_type2_
08195 >
08196 LITE_INLINE
08197 typename detail::enable_if<dim_==1, void>::type
08198 inc(pack<
08199 iter_type_,
08200 ind_type0_,
08201 ind_type1_,
08202 ind_type2_
08203 >& it)
08204 {
08205 it.i0 += it.i2;
08206 }
08207
08208 template<
08209 int dim_,
08210 typename iter_type_,
08211 typename ind_type0_,
08212 typename ind_type1_,
08213 typename ind_type2_
08214 >
08215 LITE_INLINE
08216 typename detail::enable_if<dim_==2, void>::type
08217 inc(pack<
08218 iter_type_,
08219 ind_type0_,
08220 ind_type1_,
08221 ind_type2_
08222 >& it)
08223 {
08224 it.i0 += it.i3;
08225 }
08226
08227
08228
08229
08230
08231
08232 template<
08233 int dim_,
08234 typename iter_type_,
08235 typename ind_type0_,
08236 typename ind_type1_,
08237 typename ind_type2_
08238 >
08239 LITE_INLINE
08240 typename detail::enable_if<dim_==0, void>::type
08241 dec(pack<
08242 iter_type_,
08243 ind_type0_,
08244 ind_type1_,
08245 ind_type2_
08246 >& it)
08247 {
08248 it.i0 -= it.i1;
08249 }
08250
08251 template<
08252 int dim_,
08253 typename iter_type_,
08254 typename ind_type0_,
08255 typename ind_type1_,
08256 typename ind_type2_
08257 >
08258 LITE_INLINE
08259 typename detail::enable_if<dim_==1, void>::type
08260 dec(pack<
08261 iter_type_,
08262 ind_type0_,
08263 ind_type1_,
08264 ind_type2_
08265 >& it)
08266 {
08267 it.i0 -= it.i2;
08268 }
08269
08270 template<
08271 int dim_,
08272 typename iter_type_,
08273 typename ind_type0_,
08274 typename ind_type1_,
08275 typename ind_type2_
08276 >
08277 LITE_INLINE
08278 typename detail::enable_if<dim_==2, void>::type
08279 dec(pack<
08280 iter_type_,
08281 ind_type0_,
08282 ind_type1_,
08283 ind_type2_
08284 >& it)
08285 {
08286 it.i0 -= it.i3;
08287 }
08288
08289
08290
08291
08292
08293
08294 template<
08295 int dim_,
08296 typename iter_type_,
08297 typename ind_type0_,
08298 typename ind_type1_,
08299 typename ind_type2_
08300 >
08301 LITE_INLINE
08302 typename detail::enable_if<dim_==0, void>::type
08303 shift(pack<
08304 iter_type_,
08305 ind_type0_,
08306 ind_type1_,
08307 ind_type2_
08308 >& it,
08309 int diff)
08310 {
08311 it.i0 += diff*it.i1;
08312 }
08313
08314 template<
08315 int dim_,
08316 typename iter_type_,
08317 typename ind_type0_,
08318 typename ind_type1_,
08319 typename ind_type2_
08320 >
08321 LITE_INLINE
08322 typename detail::enable_if<dim_==1, void>::type
08323 shift(pack<
08324 iter_type_,
08325 ind_type0_,
08326 ind_type1_,
08327 ind_type2_
08328 >& it,
08329 int diff)
08330 {
08331 it.i0 += diff*it.i2;
08332 }
08333
08334 template<
08335 int dim_,
08336 typename iter_type_,
08337 typename ind_type0_,
08338 typename ind_type1_,
08339 typename ind_type2_
08340 >
08341 LITE_INLINE
08342 typename detail::enable_if<dim_==2, void>::type
08343 shift(pack<
08344 iter_type_,
08345 ind_type0_,
08346 ind_type1_,
08347 ind_type2_
08348 >& it,
08349 int diff)
08350 {
08351 it.i0 += diff*it.i3;
08352 }
08353
08354
08355
08356
08357
08358
08391 template<class value_type_>
08392 class c_iterator
08393 {
08394 public:
08395 typedef std::random_access_iterator_tag iterator_category;
08396 typedef value_type_ value_type;
08397 typedef ptrdiff_t difference_type;
08398 typedef const value_type_* pointer;
08399 typedef const value_type_& reference;
08400
08401 LITE_INLINE c_iterator() {}
08402
08404 LITE_INLINE c_iterator(const value_type& value) : value(value) {}
08405
08406 LITE_INLINE c_iterator(const c_iterator& other) : value(other.value) {}
08407
08408 template<class other_value_type_>
08409 LITE_INLINE c_iterator(const c_iterator<other_value_type_>& other) : value(other.value) {}
08410
08411 LITE_INLINE c_iterator& operator=(const c_iterator& other)
08412 {
08413 value = other.value;
08414 return *this;
08415 }
08416
08417 template<class other_value_type_>
08418 LITE_INLINE c_iterator& operator=(const c_iterator<other_value_type_>& other)
08419 {
08420 value = other.value;
08421 return *this;
08422 }
08423
08425 value_type value;
08426 };
08427
08433 template<class value_type_>
08434 LITE_INLINE c_iterator<value_type_>
08435 make_c_iterator(const value_type_& val)
08436 {
08437 return c_iterator<value_type_>(val);
08438 }
08439
08440
08441
08442
08443
08444 template<typename value_type_>
08445 LITE_INLINE
08446 typename std::iterator_traits<c_iterator<value_type_> >::reference
08447 at(const c_iterator<value_type_>& it )
08448 {
08449 return it.value;
08450 }
08451 template<typename value_type_>
08452 LITE_INLINE
08453 typename std::iterator_traits<c_iterator<value_type_> >::reference
08454 at(const c_iterator<value_type_>& it, int )
08455 {
08456 return it.value;
08457 }
08458 template<typename value_type_>
08459 LITE_INLINE
08460 typename std::iterator_traits<c_iterator<value_type_> >::reference
08461 at(const c_iterator<value_type_>& it, int , int )
08462 {
08463 return it.value;
08464 }
08465 template<typename value_type_>
08466 LITE_INLINE
08467 typename std::iterator_traits<c_iterator<value_type_> >::reference
08468 at(const c_iterator<value_type_>& it, int , int , int )
08469 {
08470 return it.value;
08471 }
08472
08473
08474
08475
08476
08477 template<int dim_, typename value_type_>
08478 LITE_INLINE void inc(c_iterator<value_type_>&) {}
08479
08480
08481
08482
08483
08484 template<int dim_, typename value_type_>
08485 LITE_INLINE void dec(c_iterator<value_type_>&) {}
08486
08487
08488
08489
08490
08491 template<int dim_, typename value_type_>
08492 LITE_INLINE void shift(c_iterator<value_type_>&, int) {}
08493
08494
08495
08496
08497
08498 #ifdef DOCUMENTATION_ONLY
08499
08542 template<typename base_iter_type_, typename func_type_, bool is_static_ =true>
08543 class u_iterator
08544 {
08545 public:
08546 typedef base_iter_type_ base_iterator_type;
08547 typedef func_type_ function_type;
08548 static const bool is_static = is_static_;
08549
08550 typedef std::random_access_iterator_tag iterator_category;
08551 typedef typename detail::remove<typename func_type_::result_type, const volatile int&>::type value_type;
08552 typedef ptrdiff_t difference_type;
08553 typedef typename func_type_::result_type reference;
08554 typedef typename detail::remove<typename func_type_::result_type, int&>::type* pointer;
08555
08556 LITE_INLINE u_iterator();
08557
08559 template<class other_base_iter_type_>
08560 LITE_INLINE u_iterator(const other_base_iter_type_& base_iter);
08561
08567 template<class other_base_iter_type_>
08568 LITE_INLINE u_iterator(const other_base_iter_type_& base_iter, const function_type& func);
08569
08570 LITE_INLINE u_iterator(const u_iterator& other);
08571
08572 template<class other_base_iter_type_>
08573 LITE_INLINE u_iterator(const u_iterator<other_base_iter_type_, func_type_, is_static_>& other);
08574
08575 LITE_INLINE u_iterator& operator=(const u_iterator& other);
08576
08577 template<typename other_base_iter_type_>
08578 LITE_INLINE u_iterator& operator=(const u_iterator<other_base_iter_type_, func_type_, is_static_>& other);
08579
08581 base_iterator_type base_iterator;
08582
08584 function_type function;
08585 };
08586
08587 #endif // DOCUMENTATION_ONLY
08588
08589
08590
08591
08592
08593 #ifndef DOCUMENTATION_ONLY
08594
08595 template<typename base_iter_type_, typename func_type_>
08596 class u_iterator<base_iter_type_, func_type_, true>
08597 {
08598 public:
08599 typedef base_iter_type_ base_iterator_type;
08600 typedef func_type_ function_type;
08601 static const bool is_static = true;
08602
08603 typedef std::random_access_iterator_tag iterator_category;
08604 typedef typename detail::remove<typename func_type_::result_type, const volatile int&>::type value_type;
08605 typedef ptrdiff_t difference_type;
08606 typedef typename func_type_::result_type reference;
08607 typedef typename detail::remove<typename func_type_::result_type, int&>::type* pointer;
08608
08609 LITE_INLINE u_iterator() {}
08610
08611 template<class other_base_iter_type_>
08612 LITE_INLINE u_iterator(const other_base_iter_type_& base_iter)
08613 : base_iterator(base_iter) {}
08614
08615 LITE_INLINE u_iterator(const u_iterator& other)
08616 : base_iterator(other.base_iterator) {}
08617
08618 template<class other_base_iter_type_>
08619 LITE_INLINE u_iterator(const u_iterator<other_base_iter_type_, func_type_, true>& other)
08620 : base_iterator(other.base_iterator) {}
08621
08622 LITE_INLINE u_iterator& operator=(const u_iterator& other)
08623 {
08624 base_iterator = other.base_iterator;
08625 return *this;
08626 }
08627
08628 template<typename other_base_iter_type_>
08629 LITE_INLINE u_iterator& operator=(const u_iterator<other_base_iter_type_, func_type_, true>& other)
08630 {
08631 base_iterator = other.base_iterator;
08632 return *this;
08633 }
08634
08635 base_iterator_type base_iterator;
08636 static function_type function;
08637 };
08638
08639 template<typename base_iter_type_, typename func_type_>
08640 typename u_iterator<base_iter_type_, func_type_, true>::function_type
08641 u_iterator<base_iter_type_, func_type_, true>::function;
08642
08643 #endif // !DOCUMENTATION_ONLY
08644
08652 template<typename func_type_, typename base_iter_type_>
08653 LITE_INLINE u_iterator<base_iter_type_, func_type_, true>
08654 make_u_iterator(const base_iter_type_& it)
08655 {
08656 return u_iterator<base_iter_type_, func_type_, true>(it);
08657 }
08658
08659
08660
08661
08662
08663 #ifndef DOCUMENTATION_ONLY
08664
08665 template<typename base_iter_type_, typename func_type_>
08666 class u_iterator<base_iter_type_, func_type_, false>
08667 {
08668 public:
08669 typedef base_iter_type_ base_iterator_type;
08670 typedef func_type_ function_type;
08671 static const bool is_static = false;
08672
08673 typedef std::random_access_iterator_tag iterator_category;
08674 typedef typename detail::remove<typename func_type_::result_type, const volatile int&>::type value_type;
08675 typedef ptrdiff_t difference_type;
08676 typedef typename func_type_::result_type reference;
08677 typedef typename detail::remove<typename func_type_::result_type, int&>::type* pointer;
08678
08679 LITE_INLINE u_iterator() {}
08680
08681 template<class other_base_iter_type_>
08682 LITE_INLINE u_iterator(const other_base_iter_type_& base_iter, const function_type& func =function_type())
08683 : base_iterator(base_iter), function(func) {}
08684
08685 LITE_INLINE u_iterator(const u_iterator& other)
08686 : base_iterator(other.base_iterator), function(other.function) {}
08687
08688 template<typename other_base_iter_type_>
08689 LITE_INLINE u_iterator(const u_iterator<other_base_iter_type_, func_type_, false>& other)
08690 : base_iterator(other.base_iterator), function(other.function) {}
08691
08692 LITE_INLINE u_iterator& operator=(const u_iterator& other)
08693 {
08694 base_iterator = other.base_iterator;
08695 function = other.function;
08696 return *this;
08697 }
08698
08699 template<typename other_base_iter_type_>
08700 LITE_INLINE u_iterator& operator=(const u_iterator<other_base_iter_type_, func_type_, false>& other)
08701 {
08702 base_iterator = other.base_iterator;
08703 function = other.function;
08704 return *this;
08705 }
08706
08707 base_iterator_type base_iterator;
08708 function_type function;
08709 };
08710
08711 #endif // !DOCUMENTATION_ONLY
08712
08718 template<typename func_type_, typename base_iter_type_>
08719 LITE_INLINE u_iterator<base_iter_type_, func_type_, false>
08720 make_u_iterator(const base_iter_type_& it, const func_type_& func)
08721 {
08722 return u_iterator<base_iter_type_, func_type_, false>(it, func);
08723 }
08724
08725
08726
08727
08728
08729 template<typename base_iter_type_, typename func_type_, bool is_static_>
08730 LITE_INLINE
08731 typename u_iterator<base_iter_type_, func_type_, is_static_>::reference
08732 at(const u_iterator<base_iter_type_, func_type_, is_static_>& it
08733 )
08734 {
08735 return it.function(at(it.base_iterator
08736 ));
08737 }
08738 template<typename base_iter_type_, typename func_type_, bool is_static_>
08739 LITE_INLINE
08740 typename u_iterator<base_iter_type_, func_type_, is_static_>::reference
08741 at(const u_iterator<base_iter_type_, func_type_, is_static_>& it,
08742 int ind0
08743 )
08744 {
08745 return it.function(at(it.base_iterator,
08746 ind0
08747 ));
08748 }
08749 template<typename base_iter_type_, typename func_type_, bool is_static_>
08750 LITE_INLINE
08751 typename u_iterator<base_iter_type_, func_type_, is_static_>::reference
08752 at(const u_iterator<base_iter_type_, func_type_, is_static_>& it,
08753 int ind0,
08754 int ind1
08755 )
08756 {
08757 return it.function(at(it.base_iterator,
08758 ind0,
08759 ind1
08760 ));
08761 }
08762 template<typename base_iter_type_, typename func_type_, bool is_static_>
08763 LITE_INLINE
08764 typename u_iterator<base_iter_type_, func_type_, is_static_>::reference
08765 at(const u_iterator<base_iter_type_, func_type_, is_static_>& it,
08766 int ind0,
08767 int ind1,
08768 int ind2
08769 )
08770 {
08771 return it.function(at(it.base_iterator,
08772 ind0,
08773 ind1,
08774 ind2
08775 ));
08776 }
08777
08778
08779
08780
08781
08782 template<int dim_, typename base_iter_type_, typename func_type_, bool is_static_>
08783 LITE_INLINE void inc(u_iterator<base_iter_type_, func_type_, is_static_>& it)
08784 {
08785 inc<dim_>(it.base_iterator);
08786 }
08787
08788
08789
08790
08791
08792 template<int dim_, typename base_iter_type_, typename func_type_, bool is_static_>
08793 LITE_INLINE void dec(u_iterator<base_iter_type_, func_type_, is_static_>& it)
08794 {
08795 dec<dim_>(it.base_iterator);
08796 }
08797
08798
08799
08800
08801
08802 template<int dim_, typename base_iter_type_, typename func_type_, bool is_static_>
08803 LITE_INLINE void shift(u_iterator<base_iter_type_, func_type_, is_static_>& it, int diff)
08804 {
08805 shift<dim_>(it.base_iterator, diff);
08806 }
08807
08808
08809
08810
08811
08812 #ifdef DOCUMENTATION_ONLY
08813
08861 template<
08862 typename left_base_iterator_type_,
08863 typename right_base_iterator_type_,
08864 typename func_type_,
08865 bool is_static_ =true>
08866 class b_iterator
08867 {
08868 public:
08869 typedef left_base_iterator_type_ left_base_iterator_type;
08870 typedef right_base_iterator_type_ right_base_iterator_type;
08871 typedef func_type_ function_type;
08872 static const bool is_static = is_static_;
08873
08874 typedef std::random_access_iterator_tag iterator_category;
08875 typedef typename detail::remove<typename func_type_::result_type, const volatile int&>::type value_type;
08876 typedef ptrdiff_t difference_type;
08877 typedef typename func_type_::result_type reference;
08878 typedef typename detail::remove<typename func_type_::result_type, int&>::type* pointer;
08879
08880 LITE_INLINE b_iterator() {}
08881
08882
08884 template<typename other_left_base_iterator_type_, typename other_right_base_iterator_type_>
08885 LITE_INLINE b_iterator(
08886 const other_left_base_iterator_type_& lbase_iter,
08887 const other_right_base_iterator_type_& rbase_iter);
08888
08889 LITE_INLINE b_iterator(const b_iterator& other);
08890
08898 template<typename other_left_base_iterator_type_, typename other_right_base_iterator_type_>
08899 LITE_INLINE b_iterator(
08900 const b_iterator<
08901 other_left_base_iterator_type_,
08902 other_right_base_iterator_type_,
08903 func_type_,
08904 is_static_>& other);
08905
08906 template<typename other_left_base_iterator_type_, typename other_right_base_iterator_type_>
08907 LITE_INLINE b_iterator(
08908 const other_left_base_iterator_type_& lbase_iter,
08909 const other_right_base_iterator_type_& rbase_iter,
08910 const function_type& func);
08911
08912
08913 LITE_INLINE b_iterator& operator=(const b_iterator& other);
08914
08915 template<typename other_left_base_iterator_type_, typename other_right_base_iterator_type_>
08916 LITE_INLINE b_iterator&
08917 operator=(const b_iterator<
08918 other_left_base_iterator_type_,
08919 other_right_base_iterator_type_,
08920 func_type_,
08921 is_static_>& other);
08922
08924 left_base_iterator_type left_base_iterator;
08925
08927 right_base_iterator_type right_base_iterator;
08928
08930 function_type function;
08931 };
08932
08933
08934 #endif // DOCUMENTATION_ONLY
08935
08936
08937
08938
08939
08940 #ifndef DOCUMENTATION_ONLY
08941
08942 template<typename left_base_iterator_type_, typename right_base_iterator_type_, typename func_type_>
08943 class b_iterator<left_base_iterator_type_, right_base_iterator_type_, func_type_, true>
08944 {
08945 public:
08946 typedef left_base_iterator_type_ left_base_iterator_type;
08947 typedef right_base_iterator_type_ right_base_iterator_type;
08948 typedef func_type_ function_type;
08949 static const bool is_static = true;
08950
08951 typedef std::random_access_iterator_tag iterator_category;
08952 typedef typename detail::remove<typename func_type_::result_type, const volatile int&>::type value_type;
08953 typedef ptrdiff_t difference_type;
08954 typedef typename func_type_::result_type reference;
08955 typedef typename detail::remove<typename func_type_::result_type, int&>::type* pointer;
08956
08957 LITE_INLINE b_iterator() {}
08958
08959 template<typename other_left_base_iterator_type_, typename other_right_base_iterator_type_>
08960 LITE_INLINE b_iterator(
08961 const other_left_base_iterator_type_& lbase_iter,
08962 const other_right_base_iterator_type_& rbase_iter)
08963 : left_base_iterator(lbase_iter), right_base_iterator(rbase_iter) {}
08964
08965 LITE_INLINE b_iterator(const b_iterator& other)
08966 : left_base_iterator(other.left_base_iterator),
08967 right_base_iterator(other.right_base_iterator)
08968 {}
08969
08970 template<typename other_left_base_iterator_type_, typename other_right_base_iterator_type_>
08971 LITE_INLINE b_iterator(
08972 const b_iterator<
08973 other_left_base_iterator_type_,
08974 other_right_base_iterator_type_,
08975 func_type_,
08976 true>& other)
08977 : left_base_iterator(other.left_base_iterator),
08978 right_base_iterator(other.right_base_iterator)
08979 {}
08980
08981 LITE_INLINE b_iterator& operator=(const b_iterator& other)
08982 {
08983 left_base_iterator = other.left_base_iterator;
08984 right_base_iterator = other.right_base_iterator;
08985 return *this;
08986 }
08987
08988 template<typename other_left_base_iterator_type_, typename other_right_base_iterator_type_>
08989 LITE_INLINE b_iterator&
08990 operator=(const b_iterator<
08991 other_left_base_iterator_type_,
08992 other_right_base_iterator_type_,
08993 func_type_,
08994 true>& other)
08995 {
08996 left_base_iterator = other.left_base_iterator;
08997 right_base_iterator = other.right_base_iterator;
08998 return *this;
08999 }
09000
09001 left_base_iterator_type left_base_iterator;
09002 right_base_iterator_type right_base_iterator;
09003 static function_type function;
09004 };
09005
09006 template<typename left_base_iterator_type_, typename right_base_iterator_type_, typename func_type_>
09007 typename b_iterator<left_base_iterator_type_, right_base_iterator_type_, func_type_, true>::function_type
09008 b_iterator<left_base_iterator_type_, right_base_iterator_type_, func_type_, true>::function;
09009
09010 #endif // !DOCUMENTATION_ONLY
09011
09019 template<typename func_type_, typename left_base_iterator_type_, typename right_base_iterator_type_>
09020 LITE_INLINE b_iterator<left_base_iterator_type_, right_base_iterator_type_, func_type_, true>
09021 make_b_iterator(
09022 const left_base_iterator_type_& left_it,
09023 const right_base_iterator_type_& right_it)
09024 {
09025 return b_iterator<left_base_iterator_type_, right_base_iterator_type_, func_type_, true>
09026 (left_it, right_it);
09027 }
09028
09029
09030
09031
09032
09033 #ifndef DOCUMENTATION_ONLY
09034
09035 template<typename left_base_iterator_type_, typename right_base_iterator_type_, typename func_type_>
09036 class b_iterator<left_base_iterator_type_, right_base_iterator_type_, func_type_, false>
09037 {
09038 public:
09039 typedef left_base_iterator_type_ left_base_iterator_type;
09040 typedef right_base_iterator_type_ right_base_iterator_type;
09041 typedef func_type_ function_type;
09042 static const bool is_static = false;
09043
09044 typedef std::random_access_iterator_tag iterator_category;
09045 typedef typename detail::remove<typename func_type_::result_type, const volatile int&>::type value_type;
09046 typedef ptrdiff_t difference_type;
09047 typedef typename func_type_::result_type reference;
09048 typedef typename detail::remove<typename func_type_::result_type, int&>::type* pointer;
09049
09050 LITE_INLINE b_iterator() {}
09051
09052 template<typename other_left_base_iterator_type_, typename other_right_base_iterator_type_>
09053 LITE_INLINE b_iterator(
09054 const other_left_base_iterator_type_& lbase_iter,
09055 const other_right_base_iterator_type_& rbase_iter,
09056 const function_type& func = function_type())
09057 : left_base_iterator(lbase_iter), right_base_iterator(rbase_iter), function(func) {}
09058
09059 LITE_INLINE b_iterator(const b_iterator& other)
09060 : left_base_iterator(other.left_base_iterator),
09061 right_base_iterator(other.right_base_iterator),
09062 function(other.function)
09063 {}
09064
09065 template<typename other_left_base_iterator_type_, typename other_right_base_iterator_type_>
09066 LITE_INLINE b_iterator(
09067 const b_iterator<
09068 other_left_base_iterator_type_,
09069 other_right_base_iterator_type_,
09070 func_type_,
09071 false>& other)
09072 : left_base_iterator(other.left_base_iterator),
09073 right_base_iterator(other.right_base_iterator),
09074 function(other.function)
09075 {}
09076
09077 LITE_INLINE b_iterator& operator=(const b_iterator& other)
09078 {
09079 left_base_iterator = other.left_base_iterator;
09080 right_base_iterator = other.right_base_iterator;
09081 function = other.function;
09082 return *this;
09083 }
09084
09085 template<typename other_left_base_iterator_type_, typename other_right_base_iterator_type_>
09086 LITE_INLINE b_iterator&
09087 operator=(const b_iterator<
09088 other_left_base_iterator_type_,
09089 other_right_base_iterator_type_,
09090 func_type_,
09091 false>& other)
09092 {
09093 left_base_iterator = other.left_base_iterator;
09094 right_base_iterator = other.right_base_iterator;
09095 function = other.function;
09096 return *this;
09097 }
09098
09099 left_base_iterator_type left_base_iterator;
09100 right_base_iterator_type right_base_iterator;
09101 function_type function;
09102 };
09103
09104 #endif // DOCUMENTATION_ONLY
09105
09113 template<typename func_type_, typename left_base_iterator_type_, typename right_base_iterator_type_>
09114 LITE_INLINE b_iterator<left_base_iterator_type_, right_base_iterator_type_, func_type_, false>
09115 make_b_iterator(
09116 const left_base_iterator_type_& left_it,
09117 const right_base_iterator_type_& right_it,
09118 const func_type_& func)
09119 {
09120 return b_iterator<left_base_iterator_type_, right_base_iterator_type_, func_type_, false>
09121 (left_it, right_it, func);
09122 }
09123
09124
09125
09126
09127
09128 template<typename left_base_iter_type_, typename right_base_iter_type_, typename func_type_, bool is_static_>
09129 LITE_INLINE
09130 typename b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>::reference
09131 at(const b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>& it
09132 )
09133 {
09134 return it.function(
09135 at(it.left_base_iterator
09136 ),
09137 at(it.right_base_iterator
09138 )
09139 );
09140 }
09141 template<typename left_base_iter_type_, typename right_base_iter_type_, typename func_type_, bool is_static_>
09142 LITE_INLINE
09143 typename b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>::reference
09144 at(const b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>& it,
09145 int ind0
09146 )
09147 {
09148 return it.function(
09149 at(it.left_base_iterator,
09150 ind0
09151 ),
09152 at(it.right_base_iterator,
09153 ind0
09154 )
09155 );
09156 }
09157 template<typename left_base_iter_type_, typename right_base_iter_type_, typename func_type_, bool is_static_>
09158 LITE_INLINE
09159 typename b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>::reference
09160 at(const b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>& it,
09161 int ind0,
09162 int ind1
09163 )
09164 {
09165 return it.function(
09166 at(it.left_base_iterator,
09167 ind0,
09168 ind1
09169 ),
09170 at(it.right_base_iterator,
09171 ind0,
09172 ind1
09173 )
09174 );
09175 }
09176 template<typename left_base_iter_type_, typename right_base_iter_type_, typename func_type_, bool is_static_>
09177 LITE_INLINE
09178 typename b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>::reference
09179 at(const b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>& it,
09180 int ind0,
09181 int ind1,
09182 int ind2
09183 )
09184 {
09185 return it.function(
09186 at(it.left_base_iterator,
09187 ind0,
09188 ind1,
09189 ind2
09190 ),
09191 at(it.right_base_iterator,
09192 ind0,
09193 ind1,
09194 ind2
09195 )
09196 );
09197 }
09198
09199
09200
09201
09202
09203 template<
09204 int dim_,
09205 typename left_base_iter_type_,
09206 typename right_base_iter_type_,
09207 typename func_type_,
09208 bool is_static_>
09209 LITE_INLINE void inc(b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>& it)
09210 {
09211 inc<dim_>(it.left_base_iterator);
09212 inc<dim_>(it.right_base_iterator);
09213 }
09214
09215
09216
09217
09218
09219 template<
09220 int dim_,
09221 typename left_base_iter_type_,
09222 typename right_base_iter_type_,
09223 typename func_type_,
09224 bool is_static_>
09225 LITE_INLINE void dec(b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>& it)
09226 {
09227 dec<dim_>(it.left_base_iterator);
09228 dec<dim_>(it.right_base_iterator);
09229 }
09230
09231
09232
09233
09234
09235 template<
09236 int dim_,
09237 typename left_base_iter_type_,
09238 typename right_base_iter_type_,
09239 typename func_type_,
09240 bool is_static_>
09241 LITE_INLINE
09242 void shift(b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>& it, int diff)
09243 {
09244 shift<dim_>(it.left_base_iterator, diff);
09245 shift<dim_>(it.right_base_iterator, diff);
09246 }
09247
09248
09249
09250
09251
09252 #ifdef DOCUMENTATION_ONLY
09253
09263 template<typename transform_type_, typename input_size_type_>
09264 struct size_transformer
09265 {
09266 public:
09268 typedef ??? size_type;
09269
09278 static void transform(const input_size_type_& org, size_type& res);
09279
09283 static void transform(const transform_type& trans, const input_size_type_& org, size_type& res);
09284 };
09285
09286 #endif // DOCUMENTATION_ONLY
09287
09288
09289
09290
09291
09292 #ifdef DOCUMENTATION_ONLY
09293
09304 template<typename transform_type_, typename input_iterator_type_, typename input_size_type_>
09305 struct iterator_transformer
09306 {
09307 public:
09309 typedef ??? iterator_type;
09310
09320 static void transform(
09321 const input_iterator_type& org,
09322 iterator_type& res);
09323
09333 static void transform(
09334 const transform_type_& trans,
09335 const input_iterator_type& org,
09336 iterator_type& res);
09337
09343 static void transform(
09344 const transform_type_& trans,
09345 const input_iterator_type& org,
09346 const input_size_type_& sz,
09347 iterator_type& res);
09348 };
09349
09350 #endif // DOCUMENTATION_ONLY
09351
09352
09353
09354
09355
09356 template<typename transform_type_, typename value_type_, typename input_size_type_>
09357 struct iterator_transformer<transform_type_, c_iterator<value_type_>, input_size_type_>
09358 {
09359 public:
09360 typedef c_iterator<value_type_> input_iterator_type;
09361 typedef input_iterator_type iterator_type;
09362
09363 static LITE_INLINE void transform(
09364 const input_iterator_type& org,
09365 iterator_type& res)
09366 {
09367 res.value = org.value;
09368 }
09369
09370 static LITE_INLINE void transform(
09371 const transform_type_&,
09372 const input_iterator_type& org,
09373 iterator_type& res)
09374 {
09375 res.value = org.value;
09376 }
09377
09378 static LITE_INLINE void transform(
09379 const transform_type_&,
09380 const input_iterator_type& org,
09381 const input_size_type_&,
09382 iterator_type& res)
09383 {
09384 res.value = org.value;
09385 }
09386 };
09387
09388
09389
09390
09391
09392 template<
09393 typename transform_type_,
09394 typename base_iter_type_,
09395 typename func_type_,
09396 typename input_size_type_>
09397 struct iterator_transformer<
09398 transform_type_,
09399 u_iterator<base_iter_type_, func_type_, true>,
09400 input_size_type_>
09401 {
09402 public:
09403 typedef iterator_transformer<transform_type_, base_iter_type_, input_size_type_> base_transformer;
09404
09405 typedef u_iterator<base_iter_type_, func_type_, true> input_iterator_type;
09406 typedef u_iterator<typename base_transformer::iterator_type, func_type_, true> iterator_type;
09407
09408 static LITE_INLINE void transform(
09409 const input_iterator_type& org,
09410 iterator_type& res)
09411 {
09412 base_transformer::transform(org.base_iterator, res.base_iterator);
09413 }
09414
09415 static LITE_INLINE void transform(
09416 const transform_type_& trans,
09417 const input_iterator_type& org,
09418 iterator_type& res)
09419 {
09420 base_transformer::transform(trans, org.base_iterator, res.base_iterator);
09421 }
09422
09423 static LITE_INLINE void transform(
09424 const transform_type_& trans,
09425 const input_iterator_type& org,
09426 const input_size_type_& sz,
09427 iterator_type& res)
09428 {
09429 base_transformer::transform(trans, org.base_iterator, sz, res.base_iterator);
09430 }
09431 };
09432
09433
09434
09435 template<
09436 typename transform_type_,
09437 typename base_iter_type_,
09438 typename func_type_,
09439 typename input_size_type_>
09440 struct iterator_transformer<
09441 transform_type_,
09442 u_iterator<base_iter_type_, func_type_, false>,
09443 input_size_type_>
09444 {
09445 public:
09446 typedef iterator_transformer<transform_type_, base_iter_type_, input_size_type_> base_transformer;
09447
09448 typedef u_iterator<base_iter_type_, func_type_, false> input_iterator_type;
09449 typedef u_iterator<typename base_transformer::iterator_type, func_type_, false> iterator_type;
09450
09451 static LITE_INLINE void transform(
09452 const input_iterator_type& org,
09453 iterator_type& res)
09454 {
09455 base_transformer::transform(org.base_iterator, res.base_iterator);
09456 res.function = org.function;
09457 }
09458
09459 static LITE_INLINE void transform(
09460 const transform_type_& trans,
09461 const input_iterator_type& org,
09462 iterator_type& res)
09463 {
09464 base_transformer::transform(trans, org.base_iterator, res.base_iterator);
09465 res.function = org.function;
09466 }
09467
09468 static LITE_INLINE void transform(
09469 const transform_type_& trans,
09470 const input_iterator_type& org,
09471 const input_size_type_& sz,
09472 iterator_type& res)
09473 {
09474 base_transformer::transform(trans, org.base_iterator, sz, res.base_iterator);
09475 res.function = org.function;
09476 }
09477 };
09478
09479
09480
09481
09482
09483 template<
09484 typename transform_type_,
09485 typename left_base_iter_type_,
09486 typename right_base_iter_type_,
09487 typename func_type_,
09488 typename input_size_type_>
09489 struct iterator_transformer<
09490 transform_type_,
09491 b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, true>,
09492 input_size_type_>
09493 {
09494 public:
09495 typedef iterator_transformer<transform_type_, left_base_iter_type_, input_size_type_>
09496 left_base_transformer;
09497
09498 typedef iterator_transformer<transform_type_, right_base_iter_type_, input_size_type_>
09499 right_base_transformer;
09500
09501 typedef b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, true> input_iterator_type;
09502
09503 typedef b_iterator<
09504 typename left_base_transformer::iterator_type,
09505 typename right_base_transformer::iterator_type,
09506 func_type_,
09507 true>
09508 iterator_type;
09509
09510 static LITE_INLINE void transform(
09511 const input_iterator_type& org,
09512 iterator_type& res)
09513 {
09514 left_base_transformer::transform(org.left_base_iterator, res.left_base_iterator);
09515 right_base_transformer::transform(org.right_base_iterator, res.right_base_iterator);
09516 }
09517
09518 static LITE_INLINE void transform(
09519 const transform_type_& trans,
09520 const input_iterator_type& org,
09521 iterator_type& res)
09522 {
09523 left_base_transformer::transform(trans, org.left_base_iterator, res.left_base_iterator);
09524 right_base_transformer::transform(trans, org.right_base_iterator, res.right_base_iterator);
09525 }
09526
09527 static LITE_INLINE void transform(
09528 const transform_type_& trans,
09529 const input_iterator_type& org,
09530 const input_size_type_& sz,
09531 iterator_type& res)
09532 {
09533 left_base_transformer::transform(trans, org.left_base_iterator, sz, res.left_base_iterator);
09534 right_base_transformer::transform(trans, org.right_base_iterator, sz, res.right_base_iterator);
09535 }
09536 };
09537
09538
09539
09540 template<
09541 typename transform_type_,
09542 typename left_base_iter_type_,
09543 typename right_base_iter_type_,
09544 typename func_type_,
09545 typename input_size_type_>
09546 struct iterator_transformer<
09547 transform_type_,
09548 b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, false>,
09549 input_size_type_>
09550 {
09551 public:
09552 typedef iterator_transformer<transform_type_, left_base_iter_type_, input_size_type_>
09553 left_base_transformer;
09554
09555 typedef iterator_transformer<transform_type_, right_base_iter_type_, input_size_type_>
09556 right_base_transformer;
09557
09558 typedef b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, false> input_iterator_type;
09559
09560 typedef b_iterator<
09561 typename left_base_transformer::iterator_type,
09562 typename right_base_transformer::iterator_type,
09563 func_type_,
09564 false>
09565 iterator_type;
09566
09567 static LITE_INLINE void transform(
09568 const input_iterator_type& org,
09569 iterator_type& res)
09570 {
09571 left_base_transformer::transform(org.left_base_iterator, res.left_base_iterator);
09572 right_base_transformer::transform(org.right_base_iterator, res.right_base_iterator);
09573 res.function = org.function;
09574 }
09575
09576 static LITE_INLINE void transform(
09577 const transform_type_& trans,
09578 const input_iterator_type& org,
09579 iterator_type& res)
09580 {
09581 left_base_transformer::transform(trans, org.left_base_iterator, res.left_base_iterator);
09582 right_base_transformer::transform(trans, org.right_base_iterator, res.right_base_iterator);
09583 res.function = org.function;
09584 }
09585
09586 static LITE_INLINE void transform(
09587 const transform_type_& trans,
09588 const input_iterator_type& org,
09589 const input_size_type_& sz,
09590 iterator_type& res)
09591 {
09592 left_base_transformer::transform(trans, org.left_base_iterator, sz, res.left_base_iterator);
09593 right_base_transformer::transform(trans, org.right_base_iterator, sz, res.right_base_iterator);
09594 res.function = org.function;
09595 }
09596 };
09597
09598
09599
09600
09601
09626 template<int dim_>
09627 class plane
09628 {
09629 public:
09631 LITE_INLINE plane(int index =0) : index(index) {}
09632
09633 LITE_INLINE plane(const plane& other) : index(other.index) {}
09634
09635 LITE_INLINE plane& operator=(const plane& other) { index = other.index; return *this; }
09636
09638 int index;
09639 };
09640
09641
09642
09643
09644
09645 template<
09646 typename type0_
09647 >
09648 struct size_transformer<
09649 plane<0>,
09650 pack<
09651 type0_
09652 > >
09653 {
09654 public:
09655 typedef plane<0> transform_type;
09656
09657 typedef pack<
09658 type0_
09659 > input_size_type;
09660
09661 typedef sub_pack<
09662 input_size_type,
09663 false
09664 > sub_pack_type;
09665
09666 typedef typename sub_pack_type::type size_type;
09667
09668 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
09669 {
09670 sub_pack_type::set(res, org);
09671 }
09672
09673 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
09674 {
09675 sub_pack_type::set(res, org);
09676 }
09677 };
09678
09679
09680 template<
09681 typename type0_,
09682 typename type1_
09683 >
09684 struct size_transformer<
09685 plane<0>,
09686 pack<
09687 type0_,
09688 type1_
09689 > >
09690 {
09691 public:
09692 typedef plane<0> transform_type;
09693
09694 typedef pack<
09695 type0_,
09696 type1_
09697 > input_size_type;
09698
09699 typedef sub_pack<
09700 input_size_type,
09701 false,
09702 true
09703 > sub_pack_type;
09704
09705 typedef typename sub_pack_type::type size_type;
09706
09707 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
09708 {
09709 sub_pack_type::set(res, org);
09710 }
09711
09712 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
09713 {
09714 sub_pack_type::set(res, org);
09715 }
09716 };
09717
09718
09719 template<
09720 typename type0_,
09721 typename type1_,
09722 typename type2_
09723 >
09724 struct size_transformer<
09725 plane<0>,
09726 pack<
09727 type0_,
09728 type1_,
09729 type2_
09730 > >
09731 {
09732 public:
09733 typedef plane<0> transform_type;
09734
09735 typedef pack<
09736 type0_,
09737 type1_,
09738 type2_
09739 > input_size_type;
09740
09741 typedef sub_pack<
09742 input_size_type,
09743 false,
09744 true,
09745 true
09746 > sub_pack_type;
09747
09748 typedef typename sub_pack_type::type size_type;
09749
09750 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
09751 {
09752 sub_pack_type::set(res, org);
09753 }
09754
09755 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
09756 {
09757 sub_pack_type::set(res, org);
09758 }
09759 };
09760
09761
09762 template<
09763 typename type0_,
09764 typename type1_
09765 >
09766 struct size_transformer<
09767 plane<1>,
09768 pack<
09769 type0_,
09770 type1_
09771 > >
09772 {
09773 public:
09774 typedef plane<1> transform_type;
09775
09776 typedef pack<
09777 type0_,
09778 type1_
09779 > input_size_type;
09780
09781 typedef sub_pack<
09782 input_size_type,
09783 true,
09784 false
09785 > sub_pack_type;
09786
09787 typedef typename sub_pack_type::type size_type;
09788
09789 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
09790 {
09791 sub_pack_type::set(res, org);
09792 }
09793
09794 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
09795 {
09796 sub_pack_type::set(res, org);
09797 }
09798 };
09799
09800
09801 template<
09802 typename type0_,
09803 typename type1_,
09804 typename type2_
09805 >
09806 struct size_transformer<
09807 plane<1>,
09808 pack<
09809 type0_,
09810 type1_,
09811 type2_
09812 > >
09813 {
09814 public:
09815 typedef plane<1> transform_type;
09816
09817 typedef pack<
09818 type0_,
09819 type1_,
09820 type2_
09821 > input_size_type;
09822
09823 typedef sub_pack<
09824 input_size_type,
09825 true,
09826 false,
09827 true
09828 > sub_pack_type;
09829
09830 typedef typename sub_pack_type::type size_type;
09831
09832 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
09833 {
09834 sub_pack_type::set(res, org);
09835 }
09836
09837 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
09838 {
09839 sub_pack_type::set(res, org);
09840 }
09841 };
09842
09843
09844 template<
09845 typename type0_,
09846 typename type1_,
09847 typename type2_
09848 >
09849 struct size_transformer<
09850 plane<2>,
09851 pack<
09852 type0_,
09853 type1_,
09854 type2_
09855 > >
09856 {
09857 public:
09858 typedef plane<2> transform_type;
09859
09860 typedef pack<
09861 type0_,
09862 type1_,
09863 type2_
09864 > input_size_type;
09865
09866 typedef sub_pack<
09867 input_size_type,
09868 true,
09869 true,
09870 false
09871 > sub_pack_type;
09872
09873 typedef typename sub_pack_type::type size_type;
09874
09875 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
09876 {
09877 sub_pack_type::set(res, org);
09878 }
09879
09880 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
09881 {
09882 sub_pack_type::set(res, org);
09883 }
09884 };
09885
09886
09887
09888
09889
09890
09891
09892 template<
09893 typename base_iter_type_,
09894 typename type0_,
09895 typename input_size_type_>
09896 struct iterator_transformer<
09897 plane<0>,
09898 pack<
09899 base_iter_type_,
09900 type0_
09901 >,
09902 input_size_type_>
09903 {
09904 public:
09905 typedef plane<0> transform_type;
09906
09907 typedef pack<
09908 base_iter_type_,
09909 type0_
09910 > input_iterator_type;
09911
09912 typedef input_size_type_ input_size_type;
09913
09914 typedef sub_pack<
09915 input_iterator_type,
09916 true,
09917 false
09918 > sub_pack_type;
09919
09920 typedef typename sub_pack_type::type iterator_type;
09921
09922 static LITE_INLINE void transform(
09923 const input_iterator_type& org,
09924 iterator_type& res)
09925 {
09926 sub_pack_type::set(res, org);
09927 }
09928
09929 static LITE_INLINE void transform(
09930 const transform_type& trans,
09931 const input_iterator_type& org,
09932 iterator_type& res)
09933 {
09934 sub_pack_type::set(res, org.i0+trans.index*org.i1, org.i1);
09935 }
09936
09937 static LITE_INLINE void transform(
09938 const transform_type& trans,
09939 const input_iterator_type& org,
09940 const input_size_type&,
09941 iterator_type& res)
09942 {
09943 sub_pack_type::set(res, org.i0+trans.index*org.i1, org.i1);
09944 }
09945 };
09946
09947
09948 template<
09949 typename base_iter_type_,
09950 typename type0_,
09951 typename type1_,
09952 typename input_size_type_>
09953 struct iterator_transformer<
09954 plane<0>,
09955 pack<
09956 base_iter_type_,
09957 type0_,
09958 type1_
09959 >,
09960 input_size_type_>
09961 {
09962 public:
09963 typedef plane<0> transform_type;
09964
09965 typedef pack<
09966 base_iter_type_,
09967 type0_,
09968 type1_
09969 > input_iterator_type;
09970
09971 typedef input_size_type_ input_size_type;
09972
09973 typedef sub_pack<
09974 input_iterator_type,
09975 true,
09976 false,
09977 true
09978 > sub_pack_type;
09979
09980 typedef typename sub_pack_type::type iterator_type;
09981
09982 static LITE_INLINE void transform(
09983 const input_iterator_type& org,
09984 iterator_type& res)
09985 {
09986 sub_pack_type::set(res, org);
09987 }
09988
09989 static LITE_INLINE void transform(
09990 const transform_type& trans,
09991 const input_iterator_type& org,
09992 iterator_type& res)
09993 {
09994 sub_pack_type::set(res, org.i0+trans.index*org.i1, org.i1, org.i2);
09995 }
09996
09997 static LITE_INLINE void transform(
09998 const transform_type& trans,
09999 const input_iterator_type& org,
10000 const input_size_type&,
10001 iterator_type& res)
10002 {
10003 sub_pack_type::set(res, org.i0+trans.index*org.i1, org.i1, org.i2);
10004 }
10005 };
10006
10007
10008 template<
10009 typename base_iter_type_,
10010 typename type0_,
10011 typename type1_,
10012 typename type2_,
10013 typename input_size_type_>
10014 struct iterator_transformer<
10015 plane<0>,
10016 pack<
10017 base_iter_type_,
10018 type0_,
10019 type1_,
10020 type2_
10021 >,
10022 input_size_type_>
10023 {
10024 public:
10025 typedef plane<0> transform_type;
10026
10027 typedef pack<
10028 base_iter_type_,
10029 type0_,
10030 type1_,
10031 type2_
10032 > input_iterator_type;
10033
10034 typedef input_size_type_ input_size_type;
10035
10036 typedef sub_pack<
10037 input_iterator_type,
10038 true,
10039 false,
10040 true,
10041 true
10042 > sub_pack_type;
10043
10044 typedef typename sub_pack_type::type iterator_type;
10045
10046 static LITE_INLINE void transform(
10047 const input_iterator_type& org,
10048 iterator_type& res)
10049 {
10050 sub_pack_type::set(res, org);
10051 }
10052
10053 static LITE_INLINE void transform(
10054 const transform_type& trans,
10055 const input_iterator_type& org,
10056 iterator_type& res)
10057 {
10058 sub_pack_type::set(res, org.i0+trans.index*org.i1, org.i1, org.i2, org.i3);
10059 }
10060
10061 static LITE_INLINE void transform(
10062 const transform_type& trans,
10063 const input_iterator_type& org,
10064 const input_size_type&,
10065 iterator_type& res)
10066 {
10067 sub_pack_type::set(res, org.i0+trans.index*org.i1, org.i1, org.i2, org.i3);
10068 }
10069 };
10070
10071
10072 template<
10073 typename base_iter_type_,
10074 typename type0_,
10075 typename type1_,
10076 typename input_size_type_>
10077 struct iterator_transformer<
10078 plane<1>,
10079 pack<
10080 base_iter_type_,
10081 type0_,
10082 type1_
10083 >,
10084 input_size_type_>
10085 {
10086 public:
10087 typedef plane<1> transform_type;
10088
10089 typedef pack<
10090 base_iter_type_,
10091 type0_,
10092 type1_
10093 > input_iterator_type;
10094
10095 typedef input_size_type_ input_size_type;
10096
10097 typedef sub_pack<
10098 input_iterator_type,
10099 true,
10100 true,
10101 false
10102 > sub_pack_type;
10103
10104 typedef typename sub_pack_type::type iterator_type;
10105
10106 static LITE_INLINE void transform(
10107 const input_iterator_type& org,
10108 iterator_type& res)
10109 {
10110 sub_pack_type::set(res, org);
10111 }
10112
10113 static LITE_INLINE void transform(
10114 const transform_type& trans,
10115 const input_iterator_type& org,
10116 iterator_type& res)
10117 {
10118 sub_pack_type::set(res, org.i0+trans.index*org.i2, org.i1, org.i2);
10119 }
10120
10121 static LITE_INLINE void transform(
10122 const transform_type& trans,
10123 const input_iterator_type& org,
10124 const input_size_type&,
10125 iterator_type& res)
10126 {
10127 sub_pack_type::set(res, org.i0+trans.index*org.i2, org.i1, org.i2);
10128 }
10129 };
10130
10131
10132 template<
10133 typename base_iter_type_,
10134 typename type0_,
10135 typename type1_,
10136 typename type2_,
10137 typename input_size_type_>
10138 struct iterator_transformer<
10139 plane<1>,
10140 pack<
10141 base_iter_type_,
10142 type0_,
10143 type1_,
10144 type2_
10145 >,
10146 input_size_type_>
10147 {
10148 public:
10149 typedef plane<1> transform_type;
10150
10151 typedef pack<
10152 base_iter_type_,
10153 type0_,
10154 type1_,
10155 type2_
10156 > input_iterator_type;
10157
10158 typedef input_size_type_ input_size_type;
10159
10160 typedef sub_pack<
10161 input_iterator_type,
10162 true,
10163 true,
10164 false,
10165 true
10166 > sub_pack_type;
10167
10168 typedef typename sub_pack_type::type iterator_type;
10169
10170 static LITE_INLINE void transform(
10171 const input_iterator_type& org,
10172 iterator_type& res)
10173 {
10174 sub_pack_type::set(res, org);
10175 }
10176
10177 static LITE_INLINE void transform(
10178 const transform_type& trans,
10179 const input_iterator_type& org,
10180 iterator_type& res)
10181 {
10182 sub_pack_type::set(res, org.i0+trans.index*org.i2, org.i1, org.i2, org.i3);
10183 }
10184
10185 static LITE_INLINE void transform(
10186 const transform_type& trans,
10187 const input_iterator_type& org,
10188 const input_size_type&,
10189 iterator_type& res)
10190 {
10191 sub_pack_type::set(res, org.i0+trans.index*org.i2, org.i1, org.i2, org.i3);
10192 }
10193 };
10194
10195
10196 template<
10197 typename base_iter_type_,
10198 typename type0_,
10199 typename type1_,
10200 typename type2_,
10201 typename input_size_type_>
10202 struct iterator_transformer<
10203 plane<2>,
10204 pack<
10205 base_iter_type_,
10206 type0_,
10207 type1_,
10208 type2_
10209 >,
10210 input_size_type_>
10211 {
10212 public:
10213 typedef plane<2> transform_type;
10214
10215 typedef pack<
10216 base_iter_type_,
10217 type0_,
10218 type1_,
10219 type2_
10220 > input_iterator_type;
10221
10222 typedef input_size_type_ input_size_type;
10223
10224 typedef sub_pack<
10225 input_iterator_type,
10226 true,
10227 true,
10228 true,
10229 false
10230 > sub_pack_type;
10231
10232 typedef typename sub_pack_type::type iterator_type;
10233
10234 static LITE_INLINE void transform(
10235 const input_iterator_type& org,
10236 iterator_type& res)
10237 {
10238 sub_pack_type::set(res, org);
10239 }
10240
10241 static LITE_INLINE void transform(
10242 const transform_type& trans,
10243 const input_iterator_type& org,
10244 iterator_type& res)
10245 {
10246 sub_pack_type::set(res, org.i0+trans.index*org.i3, org.i1, org.i2, org.i3);
10247 }
10248
10249 static LITE_INLINE void transform(
10250 const transform_type& trans,
10251 const input_iterator_type& org,
10252 const input_size_type&,
10253 iterator_type& res)
10254 {
10255 sub_pack_type::set(res, org.i0+trans.index*org.i3, org.i1, org.i2, org.i3);
10256 }
10257 };
10258
10259
10260
10261
10262
10263
10264
10289 class diagonal
10290 {
10291 public:
10292 LITE_INLINE diagonal() {}
10293
10294 LITE_INLINE diagonal(const diagonal&) {}
10295
10296 LITE_INLINE diagonal& operator=(const diagonal&) { return *this; }
10297 };
10298
10299
10300
10301
10302
10303 template<>
10304 struct size_transformer<diagonal, pack<> >
10305 {
10306 public:
10307 typedef diagonal transform_type;
10308 typedef pack<> input_size_type;
10309 typedef pack<> size_type;
10310
10311 static LITE_INLINE void transform(const input_size_type&, size_type&)
10312 {}
10313
10314 static LITE_INLINE void transform(const transform_type&, const input_size_type&, size_type&)
10315 {}
10316 };
10317
10318
10319
10320 template<
10321 typename type0_
10322 >
10323 struct size_transformer<
10324 diagonal,
10325 pack<
10326 type0_
10327 > >
10328 {
10329 private:
10330 static const int n0_ =
10331 detail::type_if<detail::same_type<type0_, int>::result, constant<int, 0>, type0_>::type::value;
10332
10333 static const int min_upto_0_ = n0_;
10334
10335 static const int min_dim_size_ = min_upto_0_;
10336
10337 static const bool has_var_size_ =
10338 detail::same_type<type0_, int>::result
10339 ;
10340
10341 public:
10342 typedef diagonal transform_type;
10343
10344 typedef pack<
10345 type0_
10346 > input_size_type;
10347
10348
10349 typedef pack<
10350 typename detail::type_if<has_var_size_, int, constant<int, min_dim_size_> >::type
10351 > size_type;
10352
10353 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
10354 {
10355 const int min_upto_0 = res.i0;
10356
10357 res.set(min_upto_0);
10358 LITE_ARRAY_USE(org);
10359 }
10360
10361 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
10362 {
10363 const int min_upto_0 = res.i0;
10364
10365 res.set(min_upto_0);
10366 LITE_ARRAY_USE(org);
10367 }
10368 };
10369
10370
10371 template<
10372 typename type0_,
10373 typename type1_
10374 >
10375 struct size_transformer<
10376 diagonal,
10377 pack<
10378 type0_,
10379 type1_
10380 > >
10381 {
10382 private:
10383 static const int n0_ =
10384 detail::type_if<detail::same_type<type0_, int>::result, constant<int, 0>, type0_>::type::value;
10385 static const int n1_ =
10386 detail::type_if<detail::same_type<type1_, int>::result, constant<int, 0>, type1_>::type::value;
10387
10388 static const int min_upto_0_ = n0_;
10389 static const int min_upto_1_ = min_upto_0_ < n1_ ? min_upto_0_ : n1_;
10390
10391 static const int min_dim_size_ = min_upto_1_;
10392
10393 static const bool has_var_size_ =
10394 detail::same_type<type0_, int>::result||
10395 detail::same_type<type1_, int>::result
10396 ;
10397
10398 public:
10399 typedef diagonal transform_type;
10400
10401 typedef pack<
10402 type0_,
10403 type1_
10404 > input_size_type;
10405
10406
10407 typedef pack<
10408 typename detail::type_if<has_var_size_, int, constant<int, min_dim_size_> >::type
10409 > size_type;
10410
10411 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
10412 {
10413 const int min_upto_0 = res.i0;
10414 const int min_upto_1 = min_upto_0 < res.i1 ? min_upto_0 : res.i1;
10415
10416 res.set(min_upto_1);
10417 LITE_ARRAY_USE(org);
10418 }
10419
10420 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
10421 {
10422 const int min_upto_0 = res.i0;
10423 const int min_upto_1 = min_upto_0 < org.i1 ? min_upto_0 : org.i1;
10424
10425 res.set(min_upto_1);
10426 LITE_ARRAY_USE(org);
10427 }
10428 };
10429
10430
10431 template<
10432 typename type0_,
10433 typename type1_,
10434 typename type2_
10435 >
10436 struct size_transformer<
10437 diagonal,
10438 pack<
10439 type0_,
10440 type1_,
10441 type2_
10442 > >
10443 {
10444 private:
10445 static const int n0_ =
10446 detail::type_if<detail::same_type<type0_, int>::result, constant<int, 0>, type0_>::type::value;
10447 static const int n1_ =
10448 detail::type_if<detail::same_type<type1_, int>::result, constant<int, 0>, type1_>::type::value;
10449 static const int n2_ =
10450 detail::type_if<detail::same_type<type2_, int>::result, constant<int, 0>, type2_>::type::value;
10451
10452 static const int min_upto_0_ = n0_;
10453 static const int min_upto_1_ = min_upto_0_ < n1_ ? min_upto_0_ : n1_;
10454 static const int min_upto_2_ = min_upto_1_ < n2_ ? min_upto_1_ : n2_;
10455
10456 static const int min_dim_size_ = min_upto_2_;
10457
10458 static const bool has_var_size_ =
10459 detail::same_type<type0_, int>::result||
10460 detail::same_type<type1_, int>::result||
10461 detail::same_type<type2_, int>::result
10462 ;
10463
10464 public:
10465 typedef diagonal transform_type;
10466
10467 typedef pack<
10468 type0_,
10469 type1_,
10470 type2_
10471 > input_size_type;
10472
10473
10474 typedef pack<
10475 typename detail::type_if<has_var_size_, int, constant<int, min_dim_size_> >::type
10476 > size_type;
10477
10478 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
10479 {
10480 const int min_upto_0 = res.i0;
10481 const int min_upto_1 = min_upto_0 < res.i1 ? min_upto_0 : res.i1;
10482 const int min_upto_2 = min_upto_1 < res.i2 ? min_upto_1 : res.i2;
10483
10484 res.set(min_upto_2);
10485 LITE_ARRAY_USE(org);
10486 }
10487
10488 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
10489 {
10490 const int min_upto_0 = res.i0;
10491 const int min_upto_1 = min_upto_0 < org.i1 ? min_upto_0 : org.i1;
10492 const int min_upto_2 = min_upto_1 < org.i2 ? min_upto_1 : org.i2;
10493
10494 res.set(min_upto_2);
10495 LITE_ARRAY_USE(org);
10496 }
10497 };
10498
10499
10500
10501
10502
10503
10504
10505
10506 template<typename base_iter_type_, typename input_size_type_>
10507 struct iterator_transformer<diagonal, pack<base_iter_type_>, input_size_type_>
10508 {
10509 public:
10510 typedef pack<base_iter_type_> input_iterator_type;
10511
10512 typedef input_size_type_ input_size_type;
10513
10514 typedef pack<base_iter_type_> iterator_type;
10515
10516 static LITE_INLINE void transform(
10517 const input_iterator_type& org,
10518 iterator_type& res)
10519 {
10520 res.i0 = org.i0;
10521 }
10522
10523 static LITE_INLINE void transform(
10524 const diagonal&,
10525 const input_iterator_type& org,
10526 iterator_type& res)
10527 {
10528 res.i0 = org.i0;
10529 }
10530
10531 static LITE_INLINE void transform(
10532 const diagonal&,
10533 const input_iterator_type& org,
10534 const input_size_type&,
10535 iterator_type& res)
10536 {
10537 res.i0 = org.i0;
10538 }
10539 };
10540
10541
10542
10543 template<
10544 typename base_iter_type_,
10545 typename type0_,
10546 typename input_size_type_>
10547 struct iterator_transformer<
10548 diagonal,
10549 pack<
10550 base_iter_type_,
10551 type0_
10552 >,
10553 input_size_type_>
10554 {
10555 private:
10556 static const int n0_ =
10557 detail::type_if<detail::same_type<type0_, int>::result, constant<int, 0>, type0_>::type::value;
10558
10559 static const int stride_ = n0_;
10560
10561 static const bool has_var_stride_ =
10562 detail::same_type<type0_, int>::result
10563 ;
10564
10565 public:
10566 typedef diagonal transform_type;
10567 typedef pack<
10568 base_iter_type_,
10569 type0_
10570 > input_iterator_type;
10571
10572 typedef input_size_type_ input_size_type;
10573
10574 typedef pack<
10575 base_iter_type_,
10576 typename detail::type_if<has_var_stride_, int, constant<int, stride_> >::type>
10577 iterator_type;
10578
10579 static LITE_INLINE void transform(
10580 const input_iterator_type& org,
10581 iterator_type& res)
10582 {
10583 res.set(org.i0, org.i1);
10584 }
10585
10586 static LITE_INLINE void transform(
10587 const transform_type&,
10588 const input_iterator_type& org,
10589 iterator_type& res)
10590 {
10591 res.set(org.i0, org.i1);
10592 }
10593
10594 static LITE_INLINE void transform(
10595 const transform_type&,
10596 const input_iterator_type& org,
10597 const input_size_type&,
10598 iterator_type& res)
10599 {
10600 res.set(org.i0, org.i1);
10601 }
10602 };
10603
10604
10605 template<
10606 typename base_iter_type_,
10607 typename type0_,
10608 typename type1_,
10609 typename input_size_type_>
10610 struct iterator_transformer<
10611 diagonal,
10612 pack<
10613 base_iter_type_,
10614 type0_,
10615 type1_
10616 >,
10617 input_size_type_>
10618 {
10619 private:
10620 static const int n0_ =
10621 detail::type_if<detail::same_type<type0_, int>::result, constant<int, 0>, type0_>::type::value;
10622 static const int n1_ =
10623 detail::type_if<detail::same_type<type1_, int>::result, constant<int, 0>, type1_>::type::value;
10624
10625 static const int stride_ = n0_ + n1_;
10626
10627 static const bool has_var_stride_ =
10628 detail::same_type<type0_, int>::result||
10629 detail::same_type<type1_, int>::result
10630 ;
10631
10632 public:
10633 typedef diagonal transform_type;
10634 typedef pack<
10635 base_iter_type_,
10636 type0_,
10637 type1_
10638 > input_iterator_type;
10639
10640 typedef input_size_type_ input_size_type;
10641
10642 typedef pack<
10643 base_iter_type_,
10644 typename detail::type_if<has_var_stride_, int, constant<int, stride_> >::type>
10645 iterator_type;
10646
10647 static LITE_INLINE void transform(
10648 const input_iterator_type& org,
10649 iterator_type& res)
10650 {
10651 res.set(org.i0, org.i1org.i2);
10652 }
10653
10654 static LITE_INLINE void transform(
10655 const transform_type&,
10656 const input_iterator_type& org,
10657 iterator_type& res)
10658 {
10659 res.set(org.i0, org.i1org.i2);
10660 }
10661
10662 static LITE_INLINE void transform(
10663 const transform_type&,
10664 const input_iterator_type& org,
10665 const input_size_type&,
10666 iterator_type& res)
10667 {
10668 res.set(org.i0, org.i1 + org.i2);
10669 }
10670 };
10671
10672
10673 template<
10674 typename base_iter_type_,
10675 typename type0_,
10676 typename type1_,
10677 typename type2_,
10678 typename input_size_type_>
10679 struct iterator_transformer<
10680 diagonal,
10681 pack<
10682 base_iter_type_,
10683 type0_,
10684 type1_,
10685 type2_
10686 >,
10687 input_size_type_>
10688 {
10689 private:
10690 static const int n0_ =
10691 detail::type_if<detail::same_type<type0_, int>::result, constant<int, 0>, type0_>::type::value;
10692 static const int n1_ =
10693 detail::type_if<detail::same_type<type1_, int>::result, constant<int, 0>, type1_>::type::value;
10694 static const int n2_ =
10695 detail::type_if<detail::same_type<type2_, int>::result, constant<int, 0>, type2_>::type::value;
10696
10697 static const int stride_ = n0_ + n1_ + n2_;
10698
10699 static const bool has_var_stride_ =
10700 detail::same_type<type0_, int>::result||
10701 detail::same_type<type1_, int>::result||
10702 detail::same_type<type2_, int>::result
10703 ;
10704
10705 public:
10706 typedef diagonal transform_type;
10707 typedef pack<
10708 base_iter_type_,
10709 type0_,
10710 type1_,
10711 type2_
10712 > input_iterator_type;
10713
10714 typedef input_size_type_ input_size_type;
10715
10716 typedef pack<
10717 base_iter_type_,
10718 typename detail::type_if<has_var_stride_, int, constant<int, stride_> >::type>
10719 iterator_type;
10720
10721 static LITE_INLINE void transform(
10722 const input_iterator_type& org,
10723 iterator_type& res)
10724 {
10725 res.set(org.i0, org.i1org.i2org.i3);
10726 }
10727
10728 static LITE_INLINE void transform(
10729 const transform_type&,
10730 const input_iterator_type& org,
10731 iterator_type& res)
10732 {
10733 res.set(org.i0, org.i1org.i2org.i3);
10734 }
10735
10736 static LITE_INLINE void transform(
10737 const transform_type&,
10738 const input_iterator_type& org,
10739 const input_size_type&,
10740 iterator_type& res)
10741 {
10742 res.set(org.i0, org.i1 + org.i2 + org.i3);
10743 }
10744 };
10745
10746
10747
10748
10749
10750
10751
10772 class transpose
10773 {
10774 public:
10775 LITE_INLINE transpose() {}
10776
10777 LITE_INLINE transpose(const transpose&) {}
10778
10779 LITE_INLINE transpose& operator=(const transpose&) { return *this; }
10780 };
10781
10782
10783
10784
10785
10786 template<>
10787 struct size_transformer<transpose, pack<> >
10788 {
10789 public:
10790 typedef transpose transform_type;
10791
10792 typedef pack<> input_size_type;
10793
10794 typedef pack<> size_type;
10795
10796 static LITE_INLINE void transform(const input_size_type&, size_type&)
10797 {}
10798
10799 static LITE_INLINE void transform(const transform_type&, const input_size_type&, size_type&)
10800 {}
10801 };
10802
10803
10804
10805 template<
10806 typename type0_
10807 >
10808 struct size_transformer<
10809 transpose,
10810 pack<
10811 type0_
10812 > >
10813 {
10814 public:
10815 typedef transpose transform_type;
10816
10817 typedef pack<
10818 type0_
10819 > input_size_type;
10820
10821 typedef pack<
10822 type0_
10823 > size_type;
10824
10825 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
10826 {
10827 set<0>(res, org.i0);
10828 LITE_ARRAY_USE(org);
10829 }
10830
10831 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
10832 {
10833 set<0>(res, org.i0);
10834 LITE_ARRAY_USE(org);
10835 }
10836 };
10837
10838
10839 template<
10840 typename type0_,
10841 typename type1_
10842 >
10843 struct size_transformer<
10844 transpose,
10845 pack<
10846 type0_,
10847 type1_
10848 > >
10849 {
10850 public:
10851 typedef transpose transform_type;
10852
10853 typedef pack<
10854 type0_,
10855 type1_
10856 > input_size_type;
10857
10858 typedef pack<
10859 type1_,
10860 type0_
10861 > size_type;
10862
10863 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
10864 {
10865 set<0>(res, org.i1);
10866 set<1>(res, org.i0);
10867 LITE_ARRAY_USE(org);
10868 }
10869
10870 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
10871 {
10872 set<0>(res, org.i1);
10873 set<1>(res, org.i0);
10874 LITE_ARRAY_USE(org);
10875 }
10876 };
10877
10878
10879 template<
10880 typename type0_,
10881 typename type1_,
10882 typename type2_
10883 >
10884 struct size_transformer<
10885 transpose,
10886 pack<
10887 type0_,
10888 type1_,
10889 type2_
10890 > >
10891 {
10892 public:
10893 typedef transpose transform_type;
10894
10895 typedef pack<
10896 type0_,
10897 type1_,
10898 type2_
10899 > input_size_type;
10900
10901 typedef pack<
10902 type2_,
10903 type1_,
10904 type0_
10905 > size_type;
10906
10907 static LITE_INLINE void transform(const input_size_type& org, size_type& res)
10908 {
10909 set<0>(res, org.i2);
10910 set<1>(res, org.i1);
10911 set<2>(res, org.i0);
10912 LITE_ARRAY_USE(org);
10913 }
10914
10915 static LITE_INLINE void transform(const transform_type&, const input_size_type& org, size_type& res)
10916 {
10917 set<0>(res, org.i2);
10918 set<1>(res, org.i1);
10919 set<2>(res, org.i0);
10920 LITE_ARRAY_USE(org);
10921 }
10922 };
10923
10924
10925
10926
10927
10928
10929
10930 template<typename base_iter_type_, typename input_size_type_>
10931 struct iterator_transformer<transpose, pack<base_iter_type_>, input_size_type_>
10932 {
10933 public:
10934 typedef transpose transform_type;
10935 typedef pack<base_iter_type_> input_iterator_type;
10936 typedef input_size_type_ input_size_type;
10937 typedef pack<base_iter_type_> iterator_type;
10938
10939 static LITE_INLINE void transform(
10940 const input_iterator_type& org,
10941 iterator_type& res)
10942 {
10943 res.i0 = org.i0;
10944 }
10945
10946 static LITE_INLINE void transform(
10947 const transform_type&,
10948 const input_iterator_type& org,
10949 iterator_type& res)
10950 {
10951 res.i0 = org.i0;
10952 }
10953
10954 static LITE_INLINE void transform(
10955 const transform_type&,
10956 const input_iterator_type& org,
10957 const input_size_type&,
10958 iterator_type& res)
10959 {
10960 res.i0 = org.i0;
10961 }
10962 };
10963
10964
10965
10966
10967 template<
10968 typename base_iter_type_,
10969 typename type0_,
10970 typename input_size_type_>
10971 struct iterator_transformer<
10972 transpose,
10973 pack<
10974 base_iter_type_,
10975 type0_
10976 >,
10977 input_size_type_>
10978 {
10979 public:
10980 typedef transpose transform_type;
10981 typedef pack<
10982 base_iter_type_,
10983 type0_
10984 > input_iterator_type;
10985
10986 typedef input_size_type_ input_size_type;
10987 typedef pack<
10988 base_iter_type_,
10989 type0_
10990 > iterator_type;
10991
10992 static LITE_INLINE void transform(
10993 const input_iterator_type& org,
10994 iterator_type& res)
10995 {
10996 res.i0 = org.i0;
10997 set<1>(res, org.i1);
10998 }
10999
11000 static LITE_INLINE void transform(
11001 const transform_type&,
11002 const input_iterator_type& org,
11003 iterator_type& res)
11004 {
11005 res.i0 = org.i0;
11006 set<1>(res, org.i1);
11007 }
11008
11009 static LITE_INLINE void transform(
11010 const transform_type&,
11011 const input_iterator_type& org,
11012 const input_size_type&,
11013 iterator_type& res)
11014 {
11015 res.i0 = org.i0;
11016 set<1>(res, org.i1);
11017 }
11018 };
11019
11020
11021
11022 template<
11023 typename base_iter_type_,
11024 typename type0_,
11025 typename type1_,
11026 typename input_size_type_>
11027 struct iterator_transformer<
11028 transpose,
11029 pack<
11030 base_iter_type_,
11031 type0_,
11032 type1_
11033 >,
11034 input_size_type_>
11035 {
11036 public:
11037 typedef transpose transform_type;
11038 typedef pack<
11039 base_iter_type_,
11040 type0_,
11041 type1_
11042 > input_iterator_type;
11043
11044 typedef input_size_type_ input_size_type;
11045 typedef pack<
11046 base_iter_type_,
11047 type1_,
11048 type0_
11049 > iterator_type;
11050
11051 static LITE_INLINE void transform(
11052 const input_iterator_type& org,
11053 iterator_type& res)
11054 {
11055 res.i0 = org.i0;
11056 set<1>(res, org.i2);
11057 set<2>(res, org.i1);
11058 }
11059
11060 static LITE_INLINE void transform(
11061 const transform_type&,
11062 const input_iterator_type& org,
11063 iterator_type& res)
11064 {
11065 res.i0 = org.i0;
11066 set<1>(res, org.i2);
11067 set<2>(res, org.i1);
11068 }
11069
11070 static LITE_INLINE void transform(
11071 const transform_type&,
11072 const input_iterator_type& org,
11073 const input_size_type&,
11074 iterator_type& res)
11075 {
11076 res.i0 = org.i0;
11077 set<1>(res, org.i2);
11078 set<2>(res, org.i1);
11079 }
11080 };
11081
11082
11083
11084 template<
11085 typename base_iter_type_,
11086 typename type0_,
11087 typename type1_,
11088 typename type2_,
11089 typename input_size_type_>
11090 struct iterator_transformer<
11091 transpose,
11092 pack<
11093 base_iter_type_,
11094 type0_,
11095 type1_,
11096 type2_
11097 >,
11098 input_size_type_>
11099 {
11100 public:
11101 typedef transpose transform_type;
11102 typedef pack<
11103 base_iter_type_,
11104 type0_,
11105 type1_,
11106 type2_
11107 > input_iterator_type;
11108
11109 typedef input_size_type_ input_size_type;
11110 typedef pack<
11111 base_iter_type_,
11112 type2_,
11113 type1_,
11114 type0_
11115 > iterator_type;
11116
11117 static LITE_INLINE void transform(
11118 const input_iterator_type& org,
11119 iterator_type& res)
11120 {
11121 res.i0 = org.i0;
11122 set<1>(res, org.i3);
11123 set<2>(res, org.i2);
11124 set<3>(res, org.i1);
11125 }
11126
11127 static LITE_INLINE void transform(
11128 const transform_type&,
11129 const input_iterator_type& org,
11130 iterator_type& res)
11131 {
11132 res.i0 = org.i0;
11133 set<1>(res, org.i3);
11134 set<2>(res, org.i2);
11135 set<3>(res, org.i1);
11136 }
11137
11138 static LITE_INLINE void transform(
11139 const transform_type&,
11140 const input_iterator_type& org,
11141 const input_size_type&,
11142 iterator_type& res)
11143 {
11144 res.i0 = org.i0;
11145 set<1>(res, org.i3);
11146 set<2>(res, org.i2);
11147 set<3>(res, org.i1);
11148 }
11149 };
11150
11151
11152
11153
11154
11155
11156
11157 #ifdef DOCUMENTATION_ONLY
11158
11257 template<int n0_ ..., int nN_>
11258 class block
11259 {
11260 public:
11262 typedef pack<...> size_type;
11263
11264 block() {}
11265
11266 block(const block& other);
11267
11275 block(int n0, ..., int nN);
11276
11284 block(const size_type& block_size, int i0 ..., int iN);
11285
11286 block& operator=(const block& other);
11287
11296 block operator()(int i0 ..., int iN) const;
11297
11299 size_type block_size;
11300
11302 int iX;
11303 };
11304
11305 #else // DOCUMENTATION_ONLY
11306
11307
11308 template<
11309 >
11310 class block<
11311 >
11312 {
11313 public:
11314
11315 typedef pack<
11316 > size_type;
11317
11318 LITE_INLINE block()
11319 : block_size()
11320 {}
11321
11322 LITE_INLINE block(const block& other)
11323 : block_size(other.block_size)
11324 {}
11325
11326
11327 LITE_INLINE block(const size_type& bs )
11328 : block_size(bs)
11329 {}
11330
11331 LITE_INLINE block& operator=(const block& other)
11332 {
11333 block_size = other.block_size;
11334 return *this;
11335 }
11336
11337 LITE_INLINE block
11338 operator()() const
11339 {
11340 return block(block_size );
11341 }
11342
11343 size_type block_size;
11344 };
11345
11346
11347
11348 template<
11349 int n0_
11350 >
11351 class block<
11352 n0_
11353 >
11354 {
11355 public:
11356
11357 typedef pack<
11358 typename detail::type_if<n0_==1, int, constant<int, n0_> >::type
11359 > size_type;
11360
11361 LITE_INLINE block()
11362 : block_size(),
11363 i0()
11364 {}
11365
11366 LITE_INLINE block(const block& other)
11367 : block_size(other.block_size),
11368 i0(other.i0)
11369 {}
11370
11371 LITE_INLINE block(int n0)
11372 : block_size(n0),
11373 i0()
11374 {}
11375
11376 LITE_INLINE block(const size_type& bs, int i0)
11377 : block_size(bs),
11378 i0(i0)
11379 {}
11380
11381 LITE_INLINE block& operator=(const block& other)
11382 {
11383 block_size = other.block_size;
11384 i0 = other.i0;
11385 return *this;
11386 }
11387
11388 LITE_INLINE block
11389 operator()(int i0) const
11390 {
11391 return block(block_size, i0);
11392 }
11393
11394 size_type block_size;
11395 int i0;
11396 };
11397
11398
11399
11400 template<
11401 int n0_,
11402 int n1_
11403 >
11404 class block<
11405 n0_,
11406 n1_
11407 >
11408 {
11409 public:
11410
11411 typedef pack<
11412 typename detail::type_if<n0_==1, int, constant<int, n0_> >::type,
11413 typename detail::type_if<n1_==1, int, constant<int, n1_> >::type
11414 > size_type;
11415
11416 LITE_INLINE block()
11417 : block_size(),
11418 i0(),
11419 i1()
11420 {}
11421
11422 LITE_INLINE block(const block& other)
11423 : block_size(other.block_size),
11424 i0(other.i0),
11425 i1(other.i1)
11426 {}
11427
11428 LITE_INLINE block(int n0, int n1)
11429 : block_size(n0, n1),
11430 i0(),
11431 i1()
11432 {}
11433
11434 LITE_INLINE block(const size_type& bs, int i0, int i1)
11435 : block_size(bs),
11436 i0(i0),
11437 i1(i1)
11438 {}
11439
11440 LITE_INLINE block& operator=(const block& other)
11441 {
11442 block_size = other.block_size;
11443 i0 = other.i0;
11444 i1 = other.i1;
11445 return *this;
11446 }
11447
11448 LITE_INLINE block
11449 operator()(int i0, int i1) const
11450 {
11451 return block(block_size, i0, i1);
11452 }
11453
11454 size_type block_size;
11455 int i0;
11456 int i1;
11457 };
11458
11459
11460
11461 template<
11462 int n0_,
11463 int n1_,
11464 int n2_
11465 >
11466 class block
11467 {
11468 public:
11469
11470 typedef pack<
11471 typename detail::type_if<n0_==1, int, constant<int, n0_> >::type,
11472 typename detail::type_if<n1_==1, int, constant<int, n1_> >::type,
11473 typename detail::type_if<n2_==1, int, constant<int, n2_> >::type
11474 > size_type;
11475
11476 LITE_INLINE block()
11477 : block_size(),
11478 i0(),
11479 i1(),
11480 i2()
11481 {}
11482
11483 LITE_INLINE block(const block& other)
11484 : block_size(other.block_size),
11485 i0(other.i0),
11486 i1(other.i1),
11487 i2(other.i2)
11488 {}
11489
11490 LITE_INLINE block(int n0, int n1, int n2)
11491 : block_size(n0, n1, n2),
11492 i0(),
11493 i1(),
11494 i2()
11495 {}
11496
11497 LITE_INLINE block(const size_type& bs, int i0, int i1, int i2)
11498 : block_size(bs),
11499 i0(i0),
11500 i1(i1),
11501 i2(i2)
11502 {}
11503
11504 LITE_INLINE block& operator=(const block& other)
11505 {
11506 block_size = other.block_size;
11507 i0 = other.i0;
11508 i1 = other.i1;
11509 i2 = other.i2;
11510 return *this;
11511 }
11512
11513 LITE_INLINE block
11514 operator()(int i0, int i1, int i2) const
11515 {
11516 return block(block_size, i0, i1, i2);
11517 }
11518
11519 size_type block_size;
11520 int i0;
11521 int i1;
11522 int i2;
11523 };
11524
11525
11526
11527 #endif // DOCUMENTATION_ONLY
11528
11529
11530
11531
11532
11533
11534 template<
11535 >
11536 struct size_transformer<
11537 block<
11538 >,
11539 pack<
11540 > >
11541 {
11542 typedef block<
11543 > transfrom_type;
11544
11545 typedef pack<
11546 > input_size_type;
11547
11548 typedef pack<
11549 > ex_size_type;
11550
11551 typedef sub_pack<
11552 ex_size_type
11553 > sub_pack_type;
11554
11555
11556 typedef sub_pack_type::type size_type;
11557
11558 static LITE_INLINE void transform(const transfrom_type&, const input_size_type&, size_type&)
11559 {}
11560
11561 private:
11562 typedef detail::compile_time_assert<transfrom_type::size_type::n == input_size_type::n>
11563 ::verified verified;
11564 };
11565
11566
11567
11568 template<
11569 int n0_,
11570 typename type0_
11571 >
11572 struct size_transformer<
11573 block<
11574 n0_
11575 >,
11576 pack<
11577 type0_
11578 > >
11579 {
11580 typedef block<
11581 n0_
11582 > transfrom_type;
11583
11584 typedef pack<
11585 type0_
11586 > input_size_type;
11587
11588 typedef pack<
11589 typename detail::type_if<
11590 n0_ == -1,
11591 type0_,
11592 typename detail::type_if<n0_ == 1, int, constant<int, n0_> >::type
11593 >::type
11594 > ex_size_type;
11595
11596 typedef sub_pack<
11597 ex_size_type,
11598 n0_!=0
11599 > sub_pack_type;
11600
11601
11602 typedef typename sub_pack_type::type size_type;
11603
11604 static LITE_INLINE void
11605 transform(const transfrom_type& trans, const input_size_type& org, size_type& res)
11606 {
11607 sub_pack_type::set(
11608 res,
11609 n0_==-1 ? org.i0 : trans.block_size.i0
11610 );
11611 LITE_ARRAY_USE(trans);
11612 LITE_ARRAY_USE(org);
11613 }
11614
11615 private:
11616 typedef typename detail::compile_time_assert<transfrom_type::size_type::n == input_size_type::n>
11617 ::verified verified;
11618 };
11619
11620
11621
11622 template<
11623 int n0_,
11624 int n1_,
11625 typename type0_,
11626 typename type1_
11627 >
11628 struct size_transformer<
11629 block<
11630 n0_,
11631 n1_
11632 >,
11633 pack<
11634 type0_,
11635 type1_
11636 > >
11637 {
11638 typedef block<
11639 n0_,
11640 n1_
11641 > transfrom_type;
11642
11643 typedef pack<
11644 type0_,
11645 type1_
11646 > input_size_type;
11647
11648 typedef pack<
11649 typename detail::type_if<
11650 n0_ == -1,
11651 type0_,
11652 typename detail::type_if<n0_ == 1, int, constant<int, n0_> >::type
11653 >::type,
11654 typename detail::type_if<
11655 n1_ == -1,
11656 type1_,
11657 typename detail::type_if<n1_ == 1, int, constant<int, n1_> >::type
11658 >::type
11659 > ex_size_type;
11660
11661 typedef sub_pack<
11662 ex_size_type,
11663 n0_!=0,
11664 n1_!=0
11665 > sub_pack_type;
11666
11667
11668 typedef typename sub_pack_type::type size_type;
11669
11670 static LITE_INLINE void
11671 transform(const transfrom_type& trans, const input_size_type& org, size_type& res)
11672 {
11673 sub_pack_type::set(
11674 res,
11675 n0_==-1 ? org.i0 : trans.block_size.i0,
11676 n1_==-1 ? org.i1 : trans.block_size.i1
11677 );
11678 LITE_ARRAY_USE(trans);
11679 LITE_ARRAY_USE(org);
11680 }
11681
11682 private:
11683 typedef typename detail::compile_time_assert<transfrom_type::size_type::n == input_size_type::n>
11684 ::verified verified;
11685 };
11686
11687
11688
11689 template<
11690 int n0_,
11691 int n1_,
11692 int n2_,
11693 typename type0_,
11694 typename type1_,
11695 typename type2_
11696 >
11697 struct size_transformer<
11698 block<
11699 n0_,
11700 n1_,
11701 n2_
11702 >,
11703 pack<
11704 type0_,
11705 type1_,
11706 type2_
11707 > >
11708 {
11709 typedef block<
11710 n0_,
11711 n1_,
11712 n2_
11713 > transfrom_type;
11714
11715 typedef pack<
11716 type0_,
11717 type1_,
11718 type2_
11719 > input_size_type;
11720
11721 typedef pack<
11722 typename detail::type_if<
11723 n0_ == -1,
11724 type0_,
11725 typename detail::type_if<n0_ == 1, int, constant<int, n0_> >::type
11726 >::type,
11727 typename detail::type_if<
11728 n1_ == -1,
11729 type1_,
11730 typename detail::type_if<n1_ == 1, int, constant<int, n1_> >::type
11731 >::type,
11732 typename detail::type_if<
11733 n2_ == -1,
11734 type2_,
11735 typename detail::type_if<n2_ == 1, int, constant<int, n2_> >::type
11736 >::type
11737 > ex_size_type;
11738
11739 typedef sub_pack<
11740 ex_size_type,
11741 n0_!=0,
11742 n1_!=0,
11743 n2_!=0
11744 > sub_pack_type;
11745
11746
11747 typedef typename sub_pack_type::type size_type;
11748
11749 static LITE_INLINE void
11750 transform(const transfrom_type& trans, const input_size_type& org, size_type& res)
11751 {
11752 sub_pack_type::set(
11753 res,
11754 n0_==-1 ? org.i0 : trans.block_size.i0,
11755 n1_==-1 ? org.i1 : trans.block_size.i1,
11756 n2_==-1 ? org.i2 : trans.block_size.i2
11757 );
11758 LITE_ARRAY_USE(trans);
11759 LITE_ARRAY_USE(org);
11760 }
11761
11762 private:
11763 typedef typename detail::compile_time_assert<transfrom_type::size_type::n == input_size_type::n>
11764 ::verified verified;
11765 };
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775 template<
11776 typename base_iterator_type_,
11777 typename input_size_type_
11778 >
11779 struct iterator_transformer<
11780 block<
11781 >,
11782 pack<
11783 base_iterator_type_
11784 >,
11785 input_size_type_
11786 >
11787 {
11788 typedef block<
11789 > transfrom_type;
11790
11791 typedef pack<
11792 base_iterator_type_
11793 > input_iterator_type;
11794
11795 typedef sub_pack<
11796 input_iterator_type,
11797 true
11798 > sub_pack_type;
11799
11800 typedef typename sub_pack_type::type iterator_type;
11801
11802 static LITE_INLINE void
11803 transform(
11804 const transfrom_type& trans,
11805 const input_iterator_type& org,
11806 iterator_type& res)
11807 {
11808 sub_pack_type::set(res, org.i0
11809
11810 );
11811
11812 LITE_ARRAY_USE(trans);
11813 }
11814
11815 static LITE_INLINE void
11816 transform(
11817 const transfrom_type& trans,
11818 const input_iterator_type& org,
11819 const input_size_type_&,
11820 iterator_type& res)
11821 {
11822 sub_pack_type::set(res, org.i0
11823
11824 );
11825
11826 LITE_ARRAY_USE(trans);
11827 }
11828
11829 private:
11830 typedef typename detail::compile_time_assert<transfrom_type::size_type::n == input_size_type_::n>
11831 ::verified verified;
11832 };
11833
11834
11835
11836 template<
11837 int n0_,
11838 typename base_iterator_type_,
11839 typename type0_,
11840 typename input_size_type_
11841 >
11842 struct iterator_transformer<
11843 block<
11844 n0_
11845 >,
11846 pack<
11847 base_iterator_type_,
11848 type0_
11849 >,
11850 input_size_type_
11851 >
11852 {
11853 typedef block<
11854 n0_
11855 > transfrom_type;
11856
11857 typedef pack<
11858 base_iterator_type_,
11859 type0_
11860 > input_iterator_type;
11861
11862 typedef sub_pack<
11863 input_iterator_type,
11864 true,
11865 n0_!=0
11866 > sub_pack_type;
11867
11868 typedef typename sub_pack_type::type iterator_type;
11869
11870 static LITE_INLINE void
11871 transform(
11872 const transfrom_type& trans,
11873 const input_iterator_type& org,
11874 iterator_type& res)
11875 {
11876 sub_pack_type::set(res, org.i0
11877 +(n0_ != -1 ? trans.i0*org.i1 : 0)
11878 ,
11879 org.i1
11880 );
11881
11882 }
11883
11884 static LITE_INLINE void
11885 transform(
11886 const transfrom_type& trans,
11887 const input_iterator_type& org,
11888 const input_size_type_&,
11889 iterator_type& res)
11890 {
11891 sub_pack_type::set(res, org.i0
11892 +(n0_ != -1 ? trans.i0*org.i1 : 0)
11893 ,
11894 org.i1
11895 );
11896
11897 }
11898
11899 private:
11900 typedef typename detail::compile_time_assert<transfrom_type::size_type::n == input_size_type_::n>
11901 ::verified verified;
11902 };
11903
11904
11905
11906 template<
11907 int n0_,
11908 int n1_,
11909 typename base_iterator_type_,
11910 typename type0_,
11911 typename type1_,
11912 typename input_size_type_
11913 >
11914 struct iterator_transformer<
11915 block<
11916 n0_,
11917 n1_
11918 >,
11919 pack<
11920 base_iterator_type_,
11921 type0_,
11922 type1_
11923 >,
11924 input_size_type_
11925 >
11926 {
11927 typedef block<
11928 n0_,
11929 n1_
11930 > transfrom_type;
11931
11932 typedef pack<
11933 base_iterator_type_,
11934 type0_,
11935 type1_
11936 > input_iterator_type;
11937
11938 typedef sub_pack<
11939 input_iterator_type,
11940 true,
11941 n0_!=0,
11942 n1_!=0
11943 > sub_pack_type;
11944
11945 typedef typename sub_pack_type::type iterator_type;
11946
11947 static LITE_INLINE void
11948 transform(
11949 const transfrom_type& trans,
11950 const input_iterator_type& org,
11951 iterator_type& res)
11952 {
11953 sub_pack_type::set(res, org.i0
11954 +(n0_ != -1 ? trans.i0*org.i1 : 0)
11955 +(n1_ != -1 ? trans.i1*org.i2 : 0)
11956 ,
11957 org.i1,
11958 org.i2
11959 );
11960
11961 }
11962
11963 static LITE_INLINE void
11964 transform(
11965 const transfrom_type& trans,
11966 const input_iterator_type& org,
11967 const input_size_type_&,
11968 iterator_type& res)
11969 {
11970 sub_pack_type::set(res, org.i0
11971 +(n0_ != -1 ? trans.i0*org.i1 : 0)
11972 +(n1_ != -1 ? trans.i1*org.i2 : 0)
11973 ,
11974 org.i1,
11975 org.i2
11976 );
11977
11978 }
11979
11980 private:
11981 typedef typename detail::compile_time_assert<transfrom_type::size_type::n == input_size_type_::n>
11982 ::verified verified;
11983 };
11984
11985
11986
11987 template<
11988 int n0_,
11989 int n1_,
11990 int n2_,
11991 typename base_iterator_type_,
11992 typename type0_,
11993 typename type1_,
11994 typename type2_,
11995 typename input_size_type_
11996 >
11997 struct iterator_transformer<
11998 block<
11999 n0_,
12000 n1_,
12001 n2_
12002 >,
12003 pack<
12004 base_iterator_type_,
12005 type0_,
12006 type1_,
12007 type2_
12008 >,
12009 input_size_type_
12010 >
12011 {
12012 typedef block<
12013 n0_,
12014 n1_,
12015 n2_
12016 > transfrom_type;
12017
12018 typedef pack<
12019 base_iterator_type_,
12020 type0_,
12021 type1_,
12022 type2_
12023 > input_iterator_type;
12024
12025 typedef sub_pack<
12026 input_iterator_type,
12027 true,
12028 n0_!=0,
12029 n1_!=0,
12030 n2_!=0
12031 > sub_pack_type;
12032
12033 typedef typename sub_pack_type::type iterator_type;
12034
12035 static LITE_INLINE void
12036 transform(
12037 const transfrom_type& trans,
12038 const input_iterator_type& org,
12039 iterator_type& res)
12040 {
12041 sub_pack_type::set(res, org.i0
12042 +(n0_ != -1 ? trans.i0*org.i1 : 0)
12043 +(n1_ != -1 ? trans.i1*org.i2 : 0)
12044 +(n2_ != -1 ? trans.i2*org.i3 : 0)
12045 ,
12046 org.i1,
12047 org.i2,
12048 org.i3
12049 );
12050
12051 }
12052
12053 static LITE_INLINE void
12054 transform(
12055 const transfrom_type& trans,
12056 const input_iterator_type& org,
12057 const input_size_type_&,
12058 iterator_type& res)
12059 {
12060 sub_pack_type::set(res, org.i0
12061 +(n0_ != -1 ? trans.i0*org.i1 : 0)
12062 +(n1_ != -1 ? trans.i1*org.i2 : 0)
12063 +(n2_ != -1 ? trans.i2*org.i3 : 0)
12064 ,
12065 org.i1,
12066 org.i2,
12067 org.i3
12068 );
12069
12070 }
12071
12072 private:
12073 typedef typename detail::compile_time_assert<transfrom_type::size_type::n == input_size_type_::n>
12074 ::verified verified;
12075 };
12076
12077
12078
12079
12080
12081
12082
12083 #ifdef DOCUMENTATION_ONLY
12084
12091 template<typename signature_, typename base_iterator_type_>
12092 struct array_signature_traits
12093 {
12095 typedef ??? element_type;
12096
12098 typedef ??? value_type;
12099
12100 typedef signature_ signature;
12101
12106 typedef ??? base_iterator_type;
12107
12113 typedef ??? default_iterator;
12114
12120 typedef ??? default_rev_iterator;
12121
12123 typedef ??? size_type;
12124
12126 static const int dimensions = ???;
12127
12129 static const int volume = ???;
12130
12132 static const bool is_fixed_size = ???;
12133 };
12134
12135 #else // DOCUMENTATION_ONLY
12136
12137 template<typename element_type_, typename base_iterator_type_>
12138 struct array_signature_traits
12139 {
12140 typedef element_type_ element_type;
12141 typedef typename detail::remove<element_type_, volatile const int>::type value_type;
12142 typedef value_type signature;
12143
12144 typedef typename detail::type_if<
12145 detail::same_type<base_iterator_type_, void>::result,
12146 element_type_*,
12147 base_iterator_type_
12148 >::type base_iterator_type;
12149
12150 typedef pack<base_iterator_type> default_iterator;
12151 typedef pack<base_iterator_type> default_rev_iterator;
12152 typedef pack<> size_type;
12153
12154 static const int dimensions = 0;
12155 static const int volume = 1;
12156 static const bool is_fixed_size = true;
12157 };
12158
12159 template<
12160 typename element_type_,
12161 int n0_,
12162 typename base_iterator_type_>
12163 struct array_signature_traits<
12164 element_type_[n0_],
12165 base_iterator_type_>
12166 {
12167 typedef element_type_ element_type;
12168 typedef typename detail::remove<element_type_, volatile const int>::type value_type;
12169 typedef value_type signature[n0_];
12170
12171 typedef typename detail::type_if<
12172 detail::same_type<base_iterator_type_, void>::result,
12173 element_type_*,
12174 base_iterator_type_
12175 >::type base_iterator_type;
12176
12177 typedef pack<
12178 base_iterator_type,
12179 constant<int, 1>
12180 > default_iterator;
12181
12182 typedef pack<
12183 base_iterator_type,
12184 constant<int, 1>
12185 > default_rev_iterator;
12186
12187 typedef pack<
12188 typename detail::type_if<n0_ == 1, int, constant<int, n0_> >::type
12189 > size_type;
12190
12191 static const int dimensions = 1;
12192 static const int volume = n0_;
12193 static const bool is_fixed_size = n0_!=1;
12194 };
12195
12196 template<
12197 typename element_type_,
12198 int n0_,
12199 int n1_,
12200 typename base_iterator_type_>
12201 struct array_signature_traits<
12202 element_type_[n0_][n1_],
12203 base_iterator_type_>
12204 {
12205 typedef element_type_ element_type;
12206 typedef typename detail::remove<element_type_, volatile const int>::type value_type;
12207 typedef value_type signature[n0_][n1_];
12208
12209 typedef typename detail::type_if<
12210 detail::same_type<base_iterator_type_, void>::result,
12211 element_type_*,
12212 base_iterator_type_
12213 >::type base_iterator_type;
12214
12215 typedef pack<
12216 base_iterator_type,
12217 typename detail::type_if<(n1_==1), int, constant<int, n1_> >::type,
12218 constant<int, 1>
12219 > default_iterator;
12220
12221 typedef pack<
12222 base_iterator_type,
12223 constant<int, 1>,
12224 typename detail::type_if<(n0_==1), int, constant<int, n0_> >::type
12225 > default_rev_iterator;
12226
12227 typedef pack<
12228 typename detail::type_if<n0_ == 1, int, constant<int, n0_> >::type,
12229 typename detail::type_if<n1_ == 1, int, constant<int, n1_> >::type
12230 > size_type;
12231
12232 static const int dimensions = 2;
12233 static const int volume = n0_ * n1_;
12234 static const bool is_fixed_size = n0_!=1 && n1_!=1;
12235 };
12236
12237 template<
12238 typename element_type_,
12239 int n0_,
12240 int n1_,
12241 int n2_,
12242 typename base_iterator_type_>
12243 struct array_signature_traits<
12244 element_type_[n0_][n1_][n2_],
12245 base_iterator_type_>
12246 {
12247 typedef element_type_ element_type;
12248 typedef typename detail::remove<element_type_, volatile const int>::type value_type;
12249 typedef value_type signature[n0_][n1_][n2_];
12250
12251 typedef typename detail::type_if<
12252 detail::same_type<base_iterator_type_, void>::result,
12253 element_type_*,
12254 base_iterator_type_
12255 >::type base_iterator_type;
12256
12257 typedef pack<
12258 base_iterator_type,
12259 typename detail::type_if<(n1_==1||n2_==1), int, constant<int, n1_*n2_> >::type,
12260 typename detail::type_if<(n2_==1), int, constant<int, n2_> >::type,
12261 constant<int, 1>
12262 > default_iterator;
12263
12264 typedef pack<
12265 base_iterator_type,
12266 constant<int, 1>,
12267 typename detail::type_if<(n0_==1), int, constant<int, n0_> >::type,
12268 typename detail::type_if<(n1_==1||n0_==1), int, constant<int, n1_*n0_> >::type
12269 > default_rev_iterator;
12270
12271 typedef pack<
12272 typename detail::type_if<n0_ == 1, int, constant<int, n0_> >::type,
12273 typename detail::type_if<n1_ == 1, int, constant<int, n1_> >::type,
12274 typename detail::type_if<n2_ == 1, int, constant<int, n2_> >::type
12275 > size_type;
12276
12277 static const int dimensions = 3;
12278 static const int volume = n0_ * n1_ * n2_;
12279 static const bool is_fixed_size = n0_!=1 && n1_!=1 && n2_!=1;
12280 };
12281
12282
12283
12284 template<
12285 typename element_type_,
12286 int n0_,
12287 int n1_,
12288 int n2_,
12289 int n3_,
12290 typename base_iterator_type_>
12291 struct array_signature_traits<
12292 element_type_[n0_][n1_][n2_][n3_],
12293 base_iterator_type_>
12294 {
12295 typedef element_type_ element_type;
12296 typedef typename detail::remove<element_type_, volatile const int>::type value_type;
12297 typedef value_type signature[n0_][n1_][n2_][n3_];
12298
12299
12300
12301
12302
12303
12304 static const int dimensions = 3+1;
12305 static const int volume = n0_ * n1_ * n2_ * n3_;
12306 static const bool is_fixed_size = n0_!=1 && n1_!=1 && n2_!=1 && n3_!=1;
12307 };
12308
12309 #endif // !DOCUMENTATION_ONLY
12310
12311
12312
12313
12314
12315 template<typename signature_, typename traits_type_>
12316 struct array_helper
12317 {
12318 typedef array<signature_, traits_type_,
12319 typename traits_type_::template representation_type<signature_>::temporary_type>
12320 temporary_array;
12321
12322 typedef array<signature_, traits_type_,
12323 typename traits_type_::template representation_type<signature_>::fwd_temporary_type>
12324 fwd_temporary_array;
12325
12326 typedef array<signature_, traits_type_,
12327 typename traits_type_::template representation_type<signature_>::rev_temporary_type>
12328 rev_temporary_array;
12329 };
12330
12331
12332
12333
12334
12335 namespace detail
12336 {
12337
12338 template<typename iterator_type_, int dim_=0>
12339 struct g_iterator_traits;
12340
12341
12342
12343
12344
12345 template<typename base_iterator_type_>
12346 struct g_iterator_traits<pack<base_iterator_type_>, 0>
12347 {
12348 typedef pack<base_iterator_type_> iterator_type;
12349
12350 static const int complexity = 1;
12351 static const int non_unit_strides_count = 0;
12352 static const int constant_strides_count = 0;
12353 static const int variable_strides_count = 0;
12354 };
12355
12356 template<
12357 typename base_iterator_type_,
12358 typename type0_,
12359 typename type1_,
12360 typename type2_
12361 >
12362 struct g_iterator_traits<
12363 pack<
12364 base_iterator_type_,
12365 type0_,
12366 type1_,
12367 type2_
12368 >,
12369 0
12370 >
12371 {
12372 typedef pack<
12373 base_iterator_type_,
12374 type0_,
12375 type1_,
12376 type2_
12377 > iterator_type;
12378
12379 static const int complexity = 2;
12380 static const int non_unit_strides_count =
12381 detail::same_type<type0_, constant<int, 1> >::result ? 0 : 1;
12382 static const int constant_strides_count = iterator_type::is_const1 ? 1 : 0;
12383 static const int variable_strides_count = iterator_type::is_const1 ? 0 : 1;
12384 };
12385 template<
12386 typename base_iterator_type_,
12387 typename type0_,
12388 typename type1_,
12389 typename type2_
12390 >
12391 struct g_iterator_traits<
12392 pack<
12393 base_iterator_type_,
12394 type0_,
12395 type1_,
12396 type2_
12397 >,
12398 1
12399 >
12400 {
12401 typedef pack<
12402 base_iterator_type_,
12403 type0_,
12404 type1_,
12405 type2_
12406 > iterator_type;
12407
12408 static const int complexity = 2;
12409 static const int non_unit_strides_count =
12410 detail::same_type<type1_, constant<int, 1> >::result ? 0 : 1;
12411 static const int constant_strides_count = iterator_type::is_const2 ? 1 : 0;
12412 static const int variable_strides_count = iterator_type::is_const2 ? 0 : 1;
12413 };
12414 template<
12415 typename base_iterator_type_,
12416 typename type0_,
12417 typename type1_,
12418 typename type2_
12419 >
12420 struct g_iterator_traits<
12421 pack<
12422 base_iterator_type_,
12423 type0_,
12424 type1_,
12425 type2_
12426 >,
12427 2
12428 >
12429 {
12430 typedef pack<
12431 base_iterator_type_,
12432 type0_,
12433 type1_,
12434 type2_
12435 > iterator_type;
12436
12437 static const int complexity = 2;
12438 static const int non_unit_strides_count =
12439 detail::same_type<type2_, constant<int, 1> >::result ? 0 : 1;
12440 static const int constant_strides_count = iterator_type::is_const3 ? 1 : 0;
12441 static const int variable_strides_count = iterator_type::is_const3 ? 0 : 1;
12442 };
12443
12444
12445
12446
12447
12448 template<typename value_type_, int dim_>
12449 struct g_iterator_traits<c_iterator<value_type_>, dim_>
12450 {
12451 typedef c_iterator<value_type_> iterator_type;
12452
12453 static const int complexity = 1;
12454 static const int non_unit_strides_count = 0;
12455 static const int constant_strides_count = 0;
12456 static const int variable_strides_count = 0;
12457 };
12458
12459
12460
12461
12462
12463 template<typename base_iter_type_, typename func_type_, bool is_static_, int dim_>
12464 struct g_iterator_traits<u_iterator<base_iter_type_, func_type_, is_static_>, dim_>
12465 {
12466 typedef u_iterator<base_iter_type_, func_type_, is_static_> iterator_type;
12467
12468 static const int complexity =
12469 g_iterator_traits<base_iter_type_, dim_>::complexity+1;
12470
12471 static const int non_unit_strides_count =
12472 g_iterator_traits<base_iter_type_, dim_>::non_unit_strides_count;
12473
12474 static const int constant_strides_count =
12475 g_iterator_traits<base_iter_type_, dim_>::constant_strides_count;
12476
12477 static const int variable_strides_count =
12478 g_iterator_traits<base_iter_type_, dim_>::variable_strides_count;
12479 };
12480
12481
12482
12483
12484
12485 template<
12486 typename left_base_iter_type_,
12487 typename right_base_iter_type_,
12488 typename func_type_,
12489 bool is_static_,
12490 int dim_>
12491 struct g_iterator_traits<
12492 b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_>, dim_>
12493 {
12494 typedef b_iterator<left_base_iter_type_, right_base_iter_type_, func_type_, is_static_> iterator_type;
12495
12496 static const int complexity =
12497 g_iterator_traits<left_base_iter_type_, dim_>::complexity
12498 +g_iterator_traits<right_base_iter_type_, dim_>::complexity+1;
12499
12500 static const int non_unit_strides_count =
12501 g_iterator_traits<left_base_iter_type_, dim_>::non_unit_strides_count
12502 +g_iterator_traits<right_base_iter_type_, dim_>::non_unit_strides_count;
12503
12504 static const int constant_strides_count =
12505 g_iterator_traits<left_base_iter_type_, dim_>::constant_strides_count
12506 +g_iterator_traits<right_base_iter_type_, dim_>::constant_strides_count;
12507
12508 static const int variable_strides_count =
12509 g_iterator_traits<left_base_iter_type_, dim_>::variable_strides_count
12510 +g_iterator_traits<right_base_iter_type_, dim_>::variable_strides_count;
12511 };
12512
12513
12514
12515
12516
12517 template<typename iterator_type_, int dim_=0>
12518 struct g_iterator_policy
12519 {
12520 typedef g_iterator_traits<iterator_type_, dim_> traits_type;
12521
12522 static const bool use_index = traits_type::constant_strides_count >= traits_type::variable_strides_count;
12523
12524 };
12525
12526
12527
12528
12529
12530 template<typename array_type_, int freq_>
12531 struct matrix_policy
12532 {};
12533
12534
12535
12536 template<typename value_type_, int n0_, typename traits_type_, typename _rep, int freq_>
12537 struct matrix_policy<array<value_type_[n0_], traits_type_, _rep>, freq_>
12538 {
12539 typedef array<value_type_[n0_], traits_type_, _rep> original_array_type;
12540
12541 typedef g_iterator_traits<typename original_array_type::iterator, 0> g_iterator_traits0;
12542
12543 static const bool should_cache_dim0 =
12544 freq_ <= 1 ? g_iterator_traits0::complexity > 8 :
12545 freq_ <= 2 ? g_iterator_traits0::complexity > 2 || g_iterator_traits0::variable_strides_count > 2 :
12546 g_iterator_traits0::complexity > 2
12547 || g_iterator_traits0::variable_strides_count > 0
12548 || g_iterator_traits0::non_unit_strides_count > 0;
12549
12550 typedef typename type_if<
12551 should_cache_dim0,
12552 typename array_helper<value_type_[n0_], traits_type_>::temporary_array,
12553 const original_array_type&
12554 >::type cached_array;
12555 };
12556
12557
12558
12559 template<typename value_type_, int n0_, int n1_, typename traits_type_, typename _rep, int freq_>
12560 struct matrix_policy<array<value_type_[n0_][n1_], traits_type_, _rep>, freq_>
12561 {
12562 typedef array<value_type_[n0_][n1_], traits_type_, _rep> original_array_type;
12563
12564 typedef g_iterator_traits<typename original_array_type::iterator, 0> g_iterator_traits0;
12565 typedef g_iterator_traits<typename original_array_type::iterator, 1> g_iterator_traits1;
12566
12567 static const bool should_cache_dim0 =
12568 freq_ <= 1 ? g_iterator_traits0::complexity > 8 :
12569 freq_ <= 2 ? g_iterator_traits0::complexity > 2 || g_iterator_traits0::variable_strides_count > 2 :
12570 g_iterator_traits0::complexity > 2
12571 || g_iterator_traits0::variable_strides_count > 0
12572 || g_iterator_traits0::non_unit_strides_count > 0;
12573
12574
12575 static const bool should_cache_dim1 =
12576 freq_ <= 1 ? g_iterator_traits1::complexity > 8 :
12577 freq_ <= 2 ? g_iterator_traits1::complexity > 2 || g_iterator_traits1::variable_strides_count > 2 :
12578 g_iterator_traits1::complexity > 2
12579 || g_iterator_traits1::variable_strides_count > 0
12580 || g_iterator_traits0::non_unit_strides_count > 0;
12581
12582 typedef typename type_if<
12583 should_cache_dim0,
12584 typename array_helper<value_type_[n0_][n1_], traits_type_>::fwd_temporary_array,
12585 const original_array_type&
12586 >::type cached_fwd_array;
12587
12588 typedef typename type_if<
12589 should_cache_dim1,
12590 typename array_helper<value_type_[n0_][n1_], traits_type_>::rev_temporary_array,
12591 const original_array_type&
12592 >::type cached_rev_array;
12593 };
12594
12595
12596
12597 template<typename value_type_, int n0_, int n1_, int n2_, typename traits_type_, typename _rep, int freq_>
12598 struct matrix_policy<array<value_type_[n0_][n1_][n2_], traits_type_, _rep>, freq_>
12599 {};
12600
12601 }
12602
12603
12604
12605
12606
12607 #ifdef DOCUMENTATION_ONLY
12608
12614 template<typename iterator_type_, typename size_type_>
12615 LITE_INLINE void for_each(const iterator_type_& iter, const size_type_& size);
12616
12623 template<typename iterator_type_, typename function_type_, typename size_type_>
12624 LITE_INLINE void for_each(const iterator_type_& iter, function_type_& func, const size_type_& size);
12625
12633 template<typename iterator_type_, typename size_type_>
12634 LITE_INLINE bool for_each_c(const iterator_type_& iter, const size_type_& size);
12635
12644 template<typename iterator_type_, typename function_type_, typename size_type_>
12645 LITE_INLINE bool for_each_c(const iterator_type_& iter, function_type_& func, const size_type_& size);
12646
12647 #else // DOCUMENTATION_ONLY
12648
12649
12650
12651
12652
12653 template<typename iterator_type_>
12654 LITE_INLINE void
12655 for_each(const iterator_type_& iter, const pack<>&)
12656 {
12657 at(iter);
12658 }
12659
12660 template<typename iterator_type_, typename function_type_>
12661 LITE_INLINE void
12662 for_each(const iterator_type_& iter, function_type_& func, const pack<>&)
12663 {
12664 func(at(iter));
12665 }
12666
12667 template<typename iterator_type_>
12668 LITE_INLINE bool
12669 for_each_c(const iterator_type_& iter, const pack<>&)
12670 {
12671 return at(iter);
12672 }
12673
12674 template<typename iterator_type_, typename function_type_>
12675 LITE_INLINE bool
12676 for_each_c(const iterator_type_& iter, function_type_& func, const pack<>&)
12677 {
12678 return func(at(iter));
12679 }
12680
12681
12682
12683
12684
12685
12686 template<typename iterator_type_>
12687 LITE_INLINE
12688 typename detail::enable_if<(
12689 detail::g_iterator_policy<iterator_type_>::use_index
12690 )>::type
12691 for_each(const iterator_type_& iter, const pack<constant<int, 1> >&)
12692 {
12693 at(iter, 0);
12694 }
12695
12696 template<typename iterator_type_, typename function_type_>
12697 LITE_INLINE
12698 typename detail::enable_if<(
12699 detail::g_iterator_policy<iterator_type_>::use_index
12700 )>::type
12701 for_each(const iterator_type_& iter, function_type_& func, const pack<constant<int, 1> >&)
12702 {
12703 func(at(iter, 0));
12704 }
12705
12706 template<typename iterator_type_, typename function_type_>
12707 LITE_INLINE
12708 typename detail::enable_if<(
12709 detail::g_iterator_policy<iterator_type_>::use_index
12710 ), bool>::type
12711 for_each_c(const iterator_type_& iter, function_type_& func, const pack<constant<int, 1> >&)
12712 {
12713 if (!func(at(iter, 0))) return false;
12714 return true;
12715 }
12716
12717 template<typename iterator_type_>
12718 LITE_INLINE
12719 typename detail::enable_if<(
12720 detail::g_iterator_policy<iterator_type_>::use_index
12721 ), bool>::type
12722 for_each_c(const iterator_type_& iter, const pack<constant<int, 1> >&)
12723 {
12724 if (!at(iter, 0)) return false;
12725 return true;
12726 }
12727
12728 template<typename iterator_type_>
12729 LITE_INLINE
12730 typename detail::enable_if<(
12731 detail::g_iterator_policy<iterator_type_>::use_index
12732 )>::type
12733 for_each(const iterator_type_& iter, const pack<constant<int, 2> >&)
12734 {
12735 at(iter, 0);
12736 at(iter, 1);
12737 }
12738
12739 template<typename iterator_type_, typename function_type_>
12740 LITE_INLINE
12741 typename detail::enable_if<(
12742 detail::g_iterator_policy<iterator_type_>::use_index
12743 )>::type
12744 for_each(const iterator_type_& iter, function_type_& func, const pack<constant<int, 2> >&)
12745 {
12746 func(at(iter, 0));
12747 func(at(iter, 1));
12748 }
12749
12750 template<typename iterator_type_, typename function_type_>
12751 LITE_INLINE
12752 typename detail::enable_if<(
12753 detail::g_iterator_policy<iterator_type_>::use_index
12754 ), bool>::type
12755 for_each_c(const iterator_type_& iter, function_type_& func, const pack<constant<int, 2> >&)
12756 {
12757 if (!func(at(iter, 0))) return false;
12758 if (!func(at(iter, 1))) return false;
12759 return true;
12760 }
12761
12762 template<typename iterator_type_>
12763 LITE_INLINE
12764 typename detail::enable_if<(
12765 detail::g_iterator_policy<iterator_type_>::use_index
12766 ), bool>::type
12767 for_each_c(const iterator_type_& iter, const pack<constant<int, 2> >&)
12768 {
12769 if (!at(iter, 0)) return false;
12770 if (!at(iter, 1)) return false;
12771 return true;
12772 }
12773
12774 template<typename iterator_type_>
12775 LITE_INLINE
12776 typename detail::enable_if<(
12777 detail::g_iterator_policy<iterator_type_>::use_index
12778 )>::type
12779 for_each(const iterator_type_& iter, const pack<constant<int, 3> >&)
12780 {
12781 at(iter, 0);
12782 at(iter, 1);
12783 at(iter, 2);
12784 }
12785
12786 template<typename iterator_type_, typename function_type_>
12787 LITE_INLINE
12788 typename detail::enable_if<(
12789 detail::g_iterator_policy<iterator_type_>::use_index
12790 )>::type
12791 for_each(const iterator_type_& iter, function_type_& func, const pack<constant<int, 3> >&)
12792 {
12793 func(at(iter, 0));
12794 func(at(iter, 1));
12795 func(at(iter, 2));
12796 }
12797
12798 template<typename iterator_type_, typename function_type_>
12799 LITE_INLINE
12800 typename detail::enable_if<(
12801 detail::g_iterator_policy<iterator_type_>::use_index
12802 ), bool>::type
12803 for_each_c(const iterator_type_& iter, function_type_& func, const pack<constant<int, 3> >&)
12804 {
12805 if (!func(at(iter, 0))) return false;
12806 if (!func(at(iter, 1))) return false;
12807 if (!func(at(iter, 2))) return false;
12808 return true;
12809 }
12810
12811 template<typename iterator_type_>
12812 LITE_INLINE
12813 typename detail::enable_if<(
12814 detail::g_iterator_policy<iterator_type_>::use_index
12815 ), bool>::type
12816 for_each_c(const iterator_type_& iter, const pack<constant<int, 3> >&)
12817 {
12818 if (!at(iter, 0)) return false;
12819 if (!at(iter, 1)) return false;
12820 if (!at(iter, 2)) return false;
12821 return true;
12822 }
12823
12824 template<typename iterator_type_>
12825 LITE_INLINE
12826 typename detail::enable_if<(
12827 detail::g_iterator_policy<iterator_type_>::use_index
12828 )>::type
12829 for_each(const iterator_type_& iter, const pack<constant<int, 4> >&)
12830 {
12831 at(iter, 0);
12832 at(iter, 1);
12833 at(iter, 2);
12834 at(iter, 3);
12835 }
12836
12837 template<typename iterator_type_, typename function_type_>
12838 LITE_INLINE
12839 typename detail::enable_if<(
12840 detail::g_iterator_policy<iterator_type_>::use_index
12841 )>::type
12842 for_each(const iterator_type_& iter, function_type_& func, const pack<constant<int, 4> >&)
12843 {
12844 func(at(iter, 0));
12845 func(at(iter, 1));
12846 func(at(iter, 2));
12847 func(at(iter, 3));
12848 }
12849
12850 template<typename iterator_type_, typename function_type_>
12851 LITE_INLINE
12852 typename detail::enable_if<(
12853 detail::g_iterator_policy<iterator_type_>::use_index
12854 ), bool>::type
12855 for_each_c(const iterator_type_& iter, function_type_& func, const pack<constant<int, 4> >&)
12856 {
12857 if (!func(at(iter, 0))) return false;
12858 if (!func(at(iter, 1))) return false;
12859 if (!func(at(iter, 2))) return false;
12860 if (!func(at(iter, 3))) return false;
12861 return true;
12862 }
12863
12864 template<typename iterator_type_>
12865 LITE_INLINE
12866 typename detail::enable_if<(
12867 detail::g_iterator_policy<iterator_type_>::use_index
12868 ), bool>::type
12869 for_each_c(const iterator_type_& iter, const pack<constant<int, 4> >&)
12870 {
12871 if (!at(iter, 0)) return false;
12872 if (!at(iter, 1)) return false;
12873 if (!at(iter, 2)) return false;
12874 if (!at(iter, 3)) return false;
12875 return true;
12876 }
12877
12878 template<typename iterator_type_>
12879 LITE_INLINE
12880 typename detail::enable_if<(
12881 detail::g_iterator_policy<iterator_type_>::use_index
12882 )>::type
12883 for_each(const iterator_type_& iter, const pack<constant<int, 5> >&)
12884 {
12885 at(iter, 0);
12886 at(iter, 1);
12887 at(iter, 2);
12888 at(iter, 3);
12889 at(iter, 4);
12890 }
12891
12892 template<typename iterator_type_, typename function_type_>
12893 LITE_INLINE
12894 typename detail::enable_if<(
12895 detail::g_iterator_policy<iterator_type_>::use_index
12896 )>::type
12897 for_each(const iterator_type_& iter, function_type_& func, const pack<constant<int, 5> >&)
12898 {
12899 func(at(iter, 0));
12900 func(at(iter, 1));
12901 func(at(iter, 2));
12902 func(at(iter, 3));
12903 func(at(iter, 4));
12904 }
12905
12906 template<typename iterator_type_, typename function_type_>
12907 LITE_INLINE
12908 typename detail::enable_if<(
12909 detail::g_iterator_policy<iterator_type_>::use_index
12910 ), bool>::type
12911 for_each_c(const iterator_type_& iter, function_type_& func, const pack<constant<int, 5> >&)
12912 {
12913 if (!func(at(iter, 0))) return false;
12914 if (!func(at(iter, 1))) return false;
12915 if (!func(at(iter, 2))) return false;
12916 if (!func(at(iter, 3))) return false;
12917 if (!func(at(iter, 4))) return false;
12918 return true;
12919 }
12920
12921 template<typename iterator_type_>
12922 LITE_INLINE
12923 typename detail::enable_if<(
12924 detail::g_iterator_policy<iterator_type_>::use_index
12925 ), bool>::type
12926 for_each_c(const iterator_type_& iter, const pack<constant<int, 5> >&)
12927 {
12928 if (!at(iter, 0)) return false;
12929 if (!at(iter, 1)) return false;
12930 if (!at(iter, 2)) return false;
12931 if (!at(iter, 3)) return false;
12932 if (!at(iter, 4)) return false;
12933 return true;
12934 }
12935
12936
12937
12938
12939
12940 template<typename iterator_type_>
12941 LITE_INLINE
12942 typename detail::enable_if<(
12943 !detail::g_iterator_policy<iterator_type_>::use_index
12944 )>::type
12945 for_each(const iterator_type_& iter, const pack<constant<int, 6> >&)
12946 {
12947 iterator_type_ it = iter;
12948
12949 at(it, 0); inc<0>(it);
12950 at(it, 1); inc<0>(it);
12951 at(it, 2); inc<0>(it);
12952 at(it, 3); inc<0>(it);
12953 at(it, 4); inc<0>(it);
12954 at(it, 5);
12955 }
12956
12957 template<typename iterator_type_, typename function_type_>
12958 LITE_INLINE
12959 typename detail::enable_if<(
12960 !detail::g_iterator_policy<iterator_type_>::use_index
12961 )>::type
12962 for_each(const iterator_type_& iter, function_type_& func, const pack<constant<int, 6> >&)
12963 {
12964 iterator_type_ it = iter;
12965
12966 func(at(it, 0)); inc<0>(it);
12967 func(at(it, 1)); inc<0>(it);
12968 func(at(it, 2)); inc<0>(it);
12969 func(at(it, 3)); inc<0>(it);
12970 func(at(it, 4)); inc<0>(it);
12971 func(at(it, 5));
12972 }
12973
12974 template<typename iterator_type_>
12975 LITE_INLINE
12976 typename detail::enable_if<(
12977 !detail::g_iterator_policy<iterator_type_>::use_index
12978 ), bool>::type
12979 for_each_c(const iterator_type_& iter, const pack<constant<int, 6> >&)
12980 {
12981 iterator_type_ it = iter;
12982
12983 if (!at(iter, 0)) return false; inc<0>(it);
12984 if (!at(iter, 1)) return false; inc<0>(it);
12985 if (!at(iter, 2)) return false; inc<0>(it);
12986 if (!at(iter, 3)) return false; inc<0>(it);
12987 if (!at(iter, 4)) return false; inc<0>(it);
12988 if (!at(iter, 5)) return false;
12989
12990 return true;
12991 }
12992
12993 template<typename iterator_type_, typename function_type_>
12994 LITE_INLINE
12995 typename detail::enable_if<(
12996 !detail::g_iterator_policy<iterator_type_>::use_index
12997 ), bool>::type
12998 for_each_c(const iterator_type_& iter, function_type_& func, const pack<constant<int, 6> >&)
12999 {
13000 iterator_type_ it = iter;
13001
13002 if (!func(at(iter, 0))) return false; inc<0>(it);
13003 if (!func(at(iter, 1))) return false; inc<0>(it);
13004 if (!func(at(iter, 2))) return false; inc<0>(it);
13005 if (!func(at(iter, 3))) return false; inc<0>(it);
13006 if (!func(at(iter, 4))) return false; inc<0>(it);
13007 if (!func(at(iter, 5))) return false;
13008
13009 return true;
13010 }
13011
13012
13013
13014
13015
13016 template<typename iterator_type_, typename type_>
13017 LITE_INLINE
13018 typename detail::enable_if<(
13019 detail::g_iterator_policy<iterator_type_>::use_index
13020 )>::type
13021 for_each(const iterator_type_& iter, const pack<type_>& size)
13022 {
13023 const int n = size.i0;
13024 int j=16;
13025 iterator_type_ it = iter;
13026
13027 for (; j<=n; j+=16) {
13028 at(it, 0);
13029 at(it, 1);
13030 at(it, 2);
13031 at(it, 3);
13032 at(it, 4);
13033 at(it, 5);
13034 at(it, 6);
13035 at(it, 7);
13036 at(it, 8);
13037 at(it, 9);
13038 at(it, 10);
13039 at(it, 11);
13040 at(it, 12);
13041 at(it, 13);
13042 at(it, 14);
13043 at(it, 15);
13044 shift<0>(it, 16);
13045 }
13046
13047 if (n & 8) {
13048 at(it, 0);
13049 at(it, 1);
13050 at(it, 2);
13051 at(it, 3);
13052 at(it, 4);
13053 at(it, 5);
13054 at(it, 6);
13055 at(it, 7);
13056 shift<0>(it, 8);
13057 }
13058 if (n & 4) {
13059 at(it, 0);
13060 at(it, 1);
13061 at(it, 2);
13062 at(it, 3);
13063 shift<0>(it, 4);
13064 }
13065 if (n & 2) {
13066 at(it, 0);
13067 at(it, 1);
13068 shift<0>(it, 2);
13069 }
13070
13071 if (n & 1)
13072 at(it, 0);
13073
13074 LITE_ARRAY_USE(size);
13075 }
13076
13077 template<typename iterator_type_, typename function_type_, typename type_>
13078 LITE_INLINE
13079 typename detail::enable_if<(
13080 detail::g_iterator_policy<iterator_type_>::use_index
13081 )>::type
13082 for_each(const iterator_type_& iter, function_type_& func, const pack<type_>& size)
13083 {
13084 const int n = size.i0;
13085 int j=16;
13086 iterator_type_ it = iter;
13087
13088 for (; j<=n; j+=16) {
13089 func(at(it, 0));
13090 func(at(it, 1));
13091 func(at(it, 2));
13092 func(at(it, 3));
13093 func(at(it, 4));
13094 func(at(it, 5));
13095 func(at(it, 6));
13096 func(at(it, 7));
13097 func(at(it, 8));
13098 func(at(it, 9));
13099 func(at(it, 10));
13100 func(at(it, 11));
13101 func(at(it, 12));
13102 func(at(it, 13));
13103 func(at(it, 14));
13104 func(at(it, 15));
13105 shift<0>(it, 16);
13106 }
13107
13108 if (n & 8) {
13109 func(at(it, 0));
13110 func(at(it, 1));
13111 func(at(it, 2));
13112 func(at(it, 3));
13113 func(at(it, 4));
13114 func(at(it, 5));
13115 func(at(it, 6));
13116 func(at(it, 7));
13117 shift<0>(it, 8);
13118 }
13119 if (n & 4) {
13120 func(at(it, 0));
13121 func(at(it, 1));
13122 func(at(it, 2));
13123 func(at(it, 3));
13124 shift<0>(it, 4);
13125 }
13126 if (n & 2) {
13127 func(at(it, 0));
13128 func(at(it, 1));
13129 shift<0>(it, 2);
13130 }
13131
13132 if (n & 1)
13133 func(at(it, 0));
13134
13135 LITE_ARRAY_USE(size);
13136 }
13137
13138 template<typename iterator_type_, typename type_>
13139 LITE_INLINE
13140 typename detail::enable_if<(
13141 detail::g_iterator_policy<iterator_type_>::use_index
13142 ), bool>::type
13143 for_each_c(const iterator_type_& iter, const pack<type_>& size)
13144 {
13145 const int n = size.i0;
13146 int j=16;
13147 iterator_type_ it = iter;
13148
13149 for (; j<=n; j+=16) {
13150 if (!at(it, 0)) return false;
13151 if (!at(it, 1)) return false;
13152 if (!at(it, 2)) return false;
13153 if (!at(it, 3)) return false;
13154 if (!at(it, 4)) return false;
13155 if (!at(it, 5)) return false;
13156 if (!at(it, 6)) return false;
13157 if (!at(it, 7)) return false;
13158 if (!at(it, 8)) return false;
13159 if (!at(it, 9)) return false;
13160 if (!at(it, 10)) return false;
13161 if (!at(it, 11)) return false;
13162 if (!at(it, 12)) return false;
13163 if (!at(it, 13)) return false;
13164 if (!at(it, 14)) return false;
13165 if (!at(it, 15)) return false;
13166 shift<0>(it, 16);
13167 }
13168
13169 if (n & 8) {
13170 if (!at(it, 0)) return false;
13171 if (!at(it, 1)) return false;
13172 if (!at(it, 2)) return false;
13173 if (!at(it, 3)) return false;
13174 if (!at(it, 4)) return false;
13175 if (!at(it, 5)) return false;
13176 if (!at(it, 6)) return false;
13177 if (!at(it, 7)) return false;
13178 shift<0>(it, 8);
13179 }
13180 if (n & 4) {
13181 if (!at(it, 0)) return false;
13182 if (!at(it, 1)) return false;
13183 if (!at(it, 2)) return false;
13184 if (!at(it, 3)) return false;
13185 shift<0>(it, 4);
13186 }
13187 if (n & 2) {
13188 if (!at(it, 0)) return false;
13189 if (!at(it, 1)) return false;
13190 shift<0>(it, 2);
13191 }
13192
13193 if (n & 1)
13194 if (!at(it, 0)) return false;
13195
13196 return true;
13197 LITE_ARRAY_USE(size);
13198 }
13199
13200 template<typename iterator_type_, typename function_type_, typename type_>
13201 LITE_INLINE
13202 typename detail::enable_if<(
13203 detail::g_iterator_policy<iterator_type_>::use_index
13204 ), bool>::type
13205 for_each_c(const iterator_type_& iter, function_type_& func, const pack<type_>& size)
13206 {
13207 const int n = size.i0;
13208 int j=16;
13209 iterator_type_ it = iter;
13210
13211 for (; j<=n; j+=16) {
13212 if (!func(at(it, 0))) return false;
13213 if (!func(at(it, 1))) return false;
13214 if (!func(at(it, 2))) return false;
13215 if (!func(at(it, 3))) return false;
13216 if (!func(at(it, 4))) return false;
13217 if (!func(at(it, 5))) return false;
13218 if (!func(at(it, 6))) return false;
13219 if (!func(at(it, 7))) return false;
13220 if (!func(at(it, 8))) return false;
13221 if (!func(at(it, 9))) return false;
13222 if (!func(at(it, 10))) return false;
13223 if (!func(at(it, 11))) return false;
13224 if (!func(at(it, 12))) return false;
13225 if (!func(at(it, 13))) return false;
13226 if (!func(at(it, 14))) return false;
13227 if (!func(at(it, 15))) return false;
13228 shift<0>(it, 16);
13229 }
13230
13231 if (n & 8) {
13232 if (!func(at(it, 0))) return false;
13233 if (!func(at(it, 1))) return false;
13234 if (!func(at(it, 2))) return false;
13235 if (!func(at(it, 3))) return false;
13236 if (!func(at(it, 4))) return false;
13237 if (!func(at(it, 5))) return false;
13238 if (!func(at(it, 6))) return false;
13239 if (!func(at(it, 7))) return false;
13240 shift<0>(it, 8);
13241 }
13242 if (n & 4) {
13243 if (!func(at(it, 0))) return false;
13244 if (!func(at(it, 1))) return false;
13245 if (!func(at(it, 2))) return false;
13246 if (!func(at(it, 3))) return false;
13247 shift<0>(it, 4);
13248 }
13249 if (n & 2) {
13250 if (!func(at(it, 0))) return false;
13251 if (!func(at(it, 1))) return false;
13252 shift<0>(it, 2);
13253 }
13254
13255 if (n & 1)
13256 if (!func(at(it, 0))) return false;
13257
13258 return true;
13259 LITE_ARRAY_USE(size);
13260 }
13261
13262
13263
13264
13265
13266 template<typename iterator_type_, typename type_>
13267 LITE_INLINE
13268 typename detail::enable_if<(
13269 !detail::g_iterator_policy<iterator_type_>::use_index
13270 )>::type
13271 for_each(const iterator_type_& iter, const pack<type_>& size)
13272 {
13273 const int n = size.i0;
13274 int j=16;
13275 iterator_type_ it = iter;
13276
13277 for (; j<=n; j+=16) {
13278 at(it); inc<0>(it);
13279 at(it); inc<0>(it);
13280 at(it); inc<0>(it);
13281 at(it); inc<0>(it);
13282 at(it); inc<0>(it);
13283 at(it); inc<0>(it);
13284 at(it); inc<0>(it);
13285 at(it); inc<0>(it);
13286 at(it); inc<0>(it);
13287 at(it); inc<0>(it);
13288 at(it); inc<0>(it);
13289 at(it); inc<0>(it);
13290 at(it); inc<0>(it);
13291 at(it); inc<0>(it);
13292 at(it); inc<0>(it);
13293 at(it); inc<0>(it);
13294 }
13295
13296 if (n & 8) {
13297 at(it); inc<0>(it);
13298 at(it); inc<0>(it);
13299 at(it); inc<0>(it);
13300 at(it); inc<0>(it);
13301 at(it); inc<0>(it);
13302 at(it); inc<0>(it);
13303 at(it); inc<0>(it);
13304 at(it); inc<0>(it);
13305 }
13306 if (n & 4) {
13307 at(it); inc<0>(it);
13308 at(it); inc<0>(it);
13309 at(it); inc<0>(it);
13310 at(it); inc<0>(it);
13311 }
13312 if (n & 2) {
13313 at(it); inc<0>(it);
13314 at(it); inc<0>(it);
13315 }
13316
13317 if (n & 1)
13318 at(it);
13319 LITE_ARRAY_USE(size);
13320 }
13321
13322 template<typename iterator_type_, typename function_type_, typename type_>
13323 LITE_INLINE
13324 typename detail::enable_if<(
13325 !detail::g_iterator_policy<iterator_type_>::use_index
13326 )>::type
13327 for_each(const iterator_type_& iter, function_type_& func, const pack<type_>& size)
13328 {
13329 const int n = size.i0;
13330 int j=16;
13331 iterator_type_ it = iter;
13332
13333 for (; j<=n; j+=16) {
13334 func(at(it)); inc<0>(it);
13335 func(at(it)); inc<0>(it);
13336 func(at(it)); inc<0>(it);
13337 func(at(it)); inc<0>(it);
13338 func(at(it)); inc<0>(it);
13339 func(at(it)); inc<0>(it);
13340 func(at(it)); inc<0>(it);
13341 func(at(it)); inc<0>(it);
13342 func(at(it)); inc<0>(it);
13343 func(at(it)); inc<0>(it);
13344 func(at(it)); inc<0>(it);
13345 func(at(it)); inc<0>(it);
13346 func(at(it)); inc<0>(it);
13347 func(at(it)); inc<0>(it);
13348 func(at(it)); inc<0>(it);
13349 func(at(it)); inc<0>(it);
13350 }
13351
13352 if (n & 8) {
13353 func(at(it)); inc<0>(it);
13354 func(at(it)); inc<0>(it);
13355 func(at(it)); inc<0>(it);
13356 func(at(it)); inc<0>(it);
13357 func(at(it)); inc<0>(it);
13358 func(at(it)); inc<0>(it);
13359 func(at(it)); inc<0>(it);
13360 func(at(it)); inc<0>(it);
13361 }
13362 if (n & 4) {
13363 func(at(it)); inc<0>(it);
13364 func(at(it)); inc<0>(it);
13365 func(at(it)); inc<0>(it);
13366 func(at(it)); inc<0>(it);
13367 }
13368 if (n & 2) {
13369 func(at(it)); inc<0>(it);
13370 func(at(it)); inc<0>(it);
13371 }
13372
13373 if (n & 1)
13374 func(at(it));
13375 LITE_ARRAY_USE(size);
13376 }
13377
13378 template<typename iterator_type_, typename type_>
13379 LITE_INLINE
13380 typename detail::enable_if<(
13381 !detail::g_iterator_policy<iterator_type_>::use_index
13382 ), bool>::type
13383 for_each_c(const iterator_type_& iter, const pack<type_>& size)
13384 {
13385 const int n = size.i0;
13386 int j=16;
13387 iterator_type_ it = iter;
13388
13389 for (; j<=n; j+=16) {
13390 if(!at(it)) return false; inc<0>(it);
13391 if(!at(it)) return false; inc<0>(it);
13392 if(!at(it)) return false; inc<0>(it);
13393 if(!at(it)) return false; inc<0>(it);
13394 if(!at(it)) return false; inc<0>(it);
13395 if(!at(it)) return false; inc<0>(it);
13396 if(!at(it)) return false; inc<0>(it);
13397 if(!at(it)) return false; inc<0>(it);
13398 if(!at(it)) return false; inc<0>(it);
13399 if(!at(it)) return false; inc<0>(it);
13400 if(!at(it)) return false; inc<0>(it);
13401 if(!at(it)) return false; inc<0>(it);
13402 if(!at(it)) return false; inc<0>(it);
13403 if(!at(it)) return false; inc<0>(it);
13404 if(!at(it)) return false; inc<0>(it);
13405 if(!at(it)) return false; inc<0>(it);
13406 }
13407
13408 if (n & 8) {
13409 if(!at(it)) return false; inc<0>(it);
13410 if(!at(it)) return false; inc<0>(it);
13411 if(!at(it)) return false; inc<0>(it);
13412 if(!at(it)) return false; inc<0>(it);
13413 if(!at(it)) return false; inc<0>(it);
13414 if(!at(it)) return false; inc<0>(it);
13415 if(!at(it)) return false; inc<0>(it);
13416 if(!at(it)) return false; inc<0>(it);
13417 }
13418 if (n & 4) {
13419 if(!at(it)) return false; inc<0>(it);
13420 if(!at(it)) return false; inc<0>(it);
13421 if(!at(it)) return false; inc<0>(it);
13422 if(!at(it)) return false; inc<0>(it);
13423 }
13424 if (n & 2) {
13425 if(!at(it)) return false; inc<0>(it);
13426 if(!at(it)) return false; inc<0>(it);
13427 }
13428
13429 if (n & 1)
13430 if(!at(it)) return false;
13431
13432 return true;
13433 LITE_ARRAY_USE(size);
13434 }
13435
13436
13437 template<typename iterator_type_, typename function_type_, typename type_>
13438 LITE_INLINE
13439 typename detail::enable_if<(
13440 !detail::g_iterator_policy<iterator_type_>::use_index
13441 ), bool>::type
13442 for_each_c(const iterator_type_& iter, function_type_& func, const pack<type_>& size)
13443 {
13444 const int n = size.i0;
13445 int j=16;
13446 iterator_type_ it = iter;
13447
13448 for (; j<=n; j+=16) {
13449 if(!func(at(it))) return false; inc<0>(it);
13450 if(!func(at(it))) return false; inc<0>(it);
13451 if(!func(at(it))) return false; inc<0>(it);
13452 if(!func(at(it))) return false; inc<0>(it);
13453 if(!func(at(it))) return false; inc<0>(it);
13454 if(!func(at(it))) return false; inc<0>(it);
13455 if(!func(at(it))) return false; inc<0>(it);
13456 if(!func(at(it))) return false; inc<0>(it);
13457 if(!func(at(it))) return false; inc<0>(it);
13458 if(!func(at(it))) return false; inc<0>(it);
13459 if(!func(at(it))) return false; inc<0>(it);
13460 if(!func(at(it))) return false; inc<0>(it);
13461 if(!func(at(it))) return false; inc<0>(it);
13462 if(!func(at(it))) return false; inc<0>(it);
13463 if(!func(at(it))) return false; inc<0>(it);
13464 if(!func(at(it))) return false; inc<0>(it);
13465 }
13466
13467 if (n & 8) {
13468 if(!func(at(it))) return false; inc<0>(it);
13469 if(!func(at(it))) return false; inc<0>(it);
13470 if(!func(at(it))) return false; inc<0>(it);
13471 if(!func(at(it))) return false; inc<0>(it);
13472 if(!func(at(it))) return false; inc<0>(it);
13473 if(!func(at(it))) return false; inc<0>(it);
13474 if(!func(at(it))) return false; inc<0>(it);
13475 if(!func(at(it))) return false; inc<0>(it);
13476 }
13477 if (n & 4) {
13478 if(!func(at(it))) return false; inc<0>(it);
13479 if(!func(at(it))) return false; inc<0>(it);
13480 if(!func(at(it))) return false; inc<0>(it);
13481 if(!func(at(it))) return false; inc<0>(it);
13482 }
13483 if (n & 2) {
13484 if(!func(at(it))) return false; inc<0>(it);
13485 if(!func(at(it))) return false; inc<0>(it);
13486 }
13487
13488 if (n & 1)
13489 if(!func(at(it))) return false; inc<0>(it);
13490
13491 return true;
13492 LITE_ARRAY_USE(size);
13493 }
13494
13495
13496
13497
13498
13499
13500 template<typename iterator_type_>
13501 LITE_INLINE
13502 typename detail::enable_if<(
13503 detail::g_iterator_policy<iterator_type_>::use_index
13504 )>::type
13505 for_each(const iterator_type_& iter, const pack<constant<int, 1>, constant<int, 1> >&)
13506 {
13507 at(iter, 0, 0);
13508 }
13509
13510 template<typename iterator_type_, typename function_type_>
13511 LITE_INLINE
13512 typename detail::enable_if<(
13513 detail::g_iterator_policy<iterator_type_>::use_index
13514 )>::type
13515 for_each(
13516 const iterator_type_& iter,
13517 function_type_& func,
13518 const pack<constant<int, 1>, constant<int, 1> >&)
13519 {
13520 func(at(iter, 0, 0));
13521 }
13522
13523 template<typename iterator_type_>
13524 LITE_INLINE
13525 typename detail::enable_if<(
13526 detail::g_iterator_policy<iterator_type_>::use_index
13527 ), bool>::type
13528 for_each_c(
13529 const iterator_type_& iter,
13530 const pack<constant<int, 1>, constant<int, 1> >&)
13531 {
13532 if (!at(iter, 0, 0)) return false;
13533 return true;
13534 }
13535
13536 template<typename iterator_type_, typename function_type_>
13537 LITE_INLINE
13538 typename detail::enable_if<(
13539 detail::g_iterator_policy<iterator_type_>::use_index
13540 ), bool>::type
13541 for_each_c(
13542 const iterator_type_& iter,
13543 function_type_& func,
13544 const pack<constant<int, 1>, constant<int, 1> >&)
13545 {
13546 if (!func(at(iter, 0, 0))) return false;
13547 return true;
13548 }
13549
13550 template<typename iterator_type_>
13551 LITE_INLINE
13552 typename detail::enable_if<(
13553 detail::g_iterator_policy<iterator_type_>::use_index
13554 )>::type
13555 for_each(const iterator_type_& iter, const pack<constant<int, 2>, constant<int, 2> >&)
13556 {
13557 at(iter, 0, 0);
13558 at(iter, 0, 1);
13559 at(iter, 1, 0);
13560 at(iter, 1, 1);
13561 }
13562
13563 template<typename iterator_type_, typename function_type_>
13564 LITE_INLINE
13565 typename detail::enable_if<(
13566 detail::g_iterator_policy<iterator_type_>::use_index
13567 )>::type
13568 for_each(
13569 const iterator_type_& iter,
13570 function_type_& func,
13571 const pack<constant<int, 2>, constant<int, 2> >&)
13572 {
13573 func(at(iter, 0, 0));
13574 func(at(iter, 0, 1));
13575 func(at(iter, 1, 0));
13576 func(at(iter, 1, 1));
13577 }
13578
13579 template<typename iterator_type_>
13580 LITE_INLINE
13581 typename detail::enable_if<(
13582 detail::g_iterator_policy<iterator_type_>::use_index
13583 ), bool>::type
13584 for_each_c(
13585 const iterator_type_& iter,
13586 const pack<constant<int, 2>, constant<int, 2> >&)
13587 {
13588 if (!at(iter, 0, 0)) return false;
13589 if (!at(iter, 0, 1)) return false;
13590 if (!at(iter, 1, 0)) return false;
13591 if (!at(iter, 1, 1)) return false;
13592 return true;
13593 }
13594
13595 template<typename iterator_type_, typename function_type_>
13596 LITE_INLINE
13597 typename detail::enable_if<(
13598 detail::g_iterator_policy<iterator_type_>::use_index
13599 ), bool>::type
13600 for_each_c(
13601 const iterator_type_& iter,
13602 function_type_& func,
13603 const pack<constant<int, 2>, constant<int, 2> >&)
13604 {
13605 if (!func(at(iter, 0, 0))) return false;
13606 if (!func(at(iter, 0, 1))) return false;
13607 if (!func(at(iter, 1, 0))) return false;
13608 if (!func(at(iter, 1, 1))) return false;
13609 return true;
13610 }
13611
13612 template<typename iterator_type_>
13613 LITE_INLINE
13614 typename detail::enable_if<(
13615 detail::g_iterator_policy<iterator_type_>::use_index
13616 )>::type
13617 for_each(const iterator_type_& iter, const pack<constant<int, 3>, constant<int, 3> >&)
13618 {
13619 at(iter, 0, 0);
13620 at(iter, 0, 1);
13621 at(iter, 0, 2);
13622 at(iter, 1, 0);
13623 at(iter, 1, 1);
13624 at(iter, 1, 2);
13625 at(iter, 2, 0);
13626 at(iter, 2, 1);
13627 at(iter, 2, 2);
13628 }
13629
13630 template<typename iterator_type_, typename function_type_>
13631 LITE_INLINE
13632 typename detail::enable_if<(
13633 detail::g_iterator_policy<iterator_type_>::use_index
13634 )>::type
13635 for_each(
13636 const iterator_type_& iter,
13637 function_type_& func,
13638 const pack<constant<int, 3>, constant<int, 3> >&)
13639 {
13640 func(at(iter, 0, 0));
13641 func(at(iter, 0, 1));
13642 func(at(iter, 0, 2));
13643 func(at(iter, 1, 0));
13644 func(at(iter, 1, 1));
13645 func(at(iter, 1, 2));
13646 func(at(iter, 2, 0));
13647 func(at(iter, 2, 1));
13648 func(at(iter, 2, 2));
13649 }
13650
13651 template<typename iterator_type_>
13652 LITE_INLINE
13653 typename detail::enable_if<(
13654 detail::g_iterator_policy<iterator_type_>::use_index
13655 ), bool>::type
13656 for_each_c(
13657 const iterator_type_& iter,
13658 const pack<constant<int, 3>, constant<int, 3> >&)
13659 {
13660 if (!at(iter, 0, 0)) return false;
13661 if (!at(iter, 0, 1)) return false;
13662 if (!at(iter, 0, 2)) return false;
13663 if (!at(iter, 1, 0)) return false;
13664 if (!at(iter, 1, 1)) return false;
13665 if (!at(iter, 1, 2)) return false;
13666 if (!at(iter, 2, 0)) return false;
13667 if (!at(iter, 2, 1)) return false;
13668 if (!at(iter, 2, 2)) return false;
13669 return true;
13670 }
13671
13672 template<typename iterator_type_, typename function_type_>
13673 LITE_INLINE
13674 typename detail::enable_if<(
13675 detail::g_iterator_policy<iterator_type_>::use_index
13676 ), bool>::type
13677 for_each_c(
13678 const iterator_type_& iter,
13679 function_type_& func,
13680 const pack<constant<int, 3>, constant<int, 3> >&)
13681 {
13682 if (!func(at(iter, 0, 0))) return false;
13683 if (!func(at(iter, 0, 1))) return false;
13684 if (!func(at(iter, 0, 2))) return false;
13685 if (!func(at(iter, 1, 0))) return false;
13686 if (!func(at(iter, 1, 1))) return false;
13687 if (!func(at(iter, 1, 2))) return false;
13688 if (!func(at(iter, 2, 0))) return false;
13689 if (!func(at(iter, 2, 1))) return false;
13690 if (!func(at(iter, 2, 2))) return false;
13691 return true;
13692 }
13693
13694 template<typename iterator_type_>
13695 LITE_INLINE
13696 typename detail::enable_if<(
13697 detail::g_iterator_policy<iterator_type_>::use_index
13698 )>::type
13699 for_each(const iterator_type_& iter, const pack<constant<int, 4>, constant<int, 4> >&)
13700 {
13701 at(iter, 0, 0);
13702 at(iter, 0, 1);
13703 at(iter, 0, 2);
13704 at(iter, 0, 3);
13705 at(iter, 1, 0);
13706 at(iter, 1, 1);
13707 at(iter, 1, 2);
13708 at(iter, 1, 3);
13709 at(iter, 2, 0);
13710 at(iter, 2, 1);
13711 at(iter, 2, 2);
13712 at(iter, 2, 3);
13713 at(iter, 3, 0);
13714 at(iter, 3, 1);
13715 at(iter, 3, 2);
13716 at(iter, 3, 3);
13717 }
13718
13719 template<typename iterator_type_, typename function_type_>
13720 LITE_INLINE
13721 typename detail::enable_if<(
13722 detail::g_iterator_policy<iterator_type_>::use_index
13723 )>::type
13724 for_each(
13725 const iterator_type_& iter,
13726 function_type_& func,
13727 const pack<constant<int, 4>, constant<int, 4> >&)
13728 {
13729 func(at(iter, 0, 0));
13730 func(at(iter, 0, 1));
13731 func(at(iter, 0, 2));
13732 func(at(iter, 0, 3));
13733 func(at(iter, 1, 0));
13734 func(at(iter, 1, 1));
13735 func(at(iter, 1, 2));
13736 func(at(iter, 1, 3));
13737 func(at(iter, 2, 0));
13738 func(at(iter, 2, 1));
13739 func(at(iter, 2, 2));
13740 func(at(iter, 2, 3));
13741 func(at(iter, 3, 0));
13742 func(at(iter, 3, 1));
13743 func(at(iter, 3, 2));
13744 func(at(iter, 3, 3));
13745 }
13746
13747 template<typename iterator_type_>
13748 LITE_INLINE
13749 typename detail::enable_if<(
13750 detail::g_iterator_policy<iterator_type_>::use_index
13751 ), bool>::type
13752 for_each_c(
13753 const iterator_type_& iter,
13754 const pack<constant<int, 4>, constant<int, 4> >&)
13755 {
13756 if (!at(iter, 0, 0)) return false;
13757 if (!at(iter, 0, 1)) return false;
13758 if (!at(iter, 0, 2)) return false;
13759 if (!at(iter, 0, 3)) return false;
13760 if (!at(iter, 1, 0)) return false;
13761 if (!at(iter, 1, 1)) return false;
13762 if (!at(iter, 1, 2)) return false;
13763 if (!at(iter, 1, 3)) return false;
13764 if (!at(iter, 2, 0)) return false;
13765 if (!at(iter, 2, 1)) return false;
13766 if (!at(iter, 2, 2)) return false;
13767 if (!at(iter, 2, 3)) return false;
13768 if (!at(iter, 3, 0)) return false;
13769 if (!at(iter, 3, 1)) return false;
13770 if (!at(iter, 3, 2)) return false;
13771 if (!at(iter, 3, 3)) return false;
13772 return true;
13773 }
13774
13775 template<typename iterator_type_, typename function_type_>
13776 LITE_INLINE
13777 typename detail::enable_if<(
13778 detail::g_iterator_policy<iterator_type_>::use_index
13779 ), bool>::type
13780 for_each_c(
13781 const iterator_type_& iter,
13782 function_type_& func,
13783 const pack<constant<int, 4>, constant<int, 4> >&)
13784 {
13785 if (!func(at(iter, 0, 0))) return false;
13786 if (!func(at(iter, 0, 1))) return false;
13787 if (!func(at(iter, 0, 2))) return false;
13788 if (!func(at(iter, 0, 3))) return false;
13789 if (!func(at(iter, 1, 0))) return false;
13790 if (!func(at(iter, 1, 1))) return false;
13791 if (!func(at(iter, 1, 2))) return false;
13792 if (!func(at(iter, 1, 3))) return false;
13793 if (!func(at(iter, 2, 0))) return false;
13794 if (!func(at(iter, 2, 1))) return false;
13795 if (!func(at(iter, 2, 2))) return false;
13796 if (!func(at(iter, 2, 3))) return false;
13797 if (!func(at(iter, 3, 0))) return false;
13798 if (!func(at(iter, 3, 1))) return false;
13799 if (!func(at(iter, 3, 2))) return false;
13800 if (!func(at(iter, 3, 3))) return false;
13801 return true;
13802 }
13803
13804 template<typename iterator_type_>
13805 LITE_INLINE
13806 typename detail::enable_if<(
13807 detail::g_iterator_policy<iterator_type_>::use_index
13808 )>::type
13809 for_each(const iterator_type_& iter, const pack<constant<int, 5>, constant<int, 5> >&)
13810 {
13811 at(iter, 0, 0);
13812 at(iter, 0, 1);
13813 at(iter, 0, 2);
13814 at(iter, 0, 3);
13815 at(iter, 0, 4);
13816 at(iter, 1, 0);
13817 at(iter, 1, 1);
13818 at(iter, 1, 2);
13819 at(iter, 1, 3);
13820 at(iter, 1, 4);
13821 at(iter, 2, 0);
13822 at(iter, 2, 1);
13823 at(iter, 2, 2);
13824 at(iter, 2, 3);
13825 at(iter, 2, 4);
13826 at(iter, 3, 0);
13827 at(iter, 3, 1);
13828 at(iter, 3, 2);
13829 at(iter, 3, 3);
13830 at(iter, 3, 4);
13831 at(iter, 4, 0);
13832 at(iter, 4, 1);
13833 at(iter, 4, 2);
13834 at(iter, 4, 3);
13835 at(iter, 4, 4);
13836 }
13837
13838 template<typename iterator_type_, typename function_type_>
13839 LITE_INLINE
13840 typename detail::enable_if<(
13841 detail::g_iterator_policy<iterator_type_>::use_index
13842 )>::type
13843 for_each(
13844 const iterator_type_& iter,
13845 function_type_& func,
13846 const pack<constant<int, 5>, constant<int, 5> >&)
13847 {
13848 func(at(iter, 0, 0));
13849 func(at(iter, 0, 1));
13850 func(at(iter, 0, 2));
13851 func(at(iter, 0, 3));
13852 func(at(iter, 0, 4));
13853 func(at(iter, 1, 0));
13854 func(at(iter, 1, 1));
13855 func(at(iter, 1, 2));
13856 func(at(iter, 1, 3));
13857 func(at(iter, 1, 4));
13858 func(at(iter, 2, 0));
13859 func(at(iter, 2, 1));
13860 func(at(iter, 2, 2));
13861 func(at(iter, 2, 3));
13862 func(at(iter, 2, 4));
13863 func(at(iter, 3, 0));
13864 func(at(iter, 3, 1));
13865 func(at(iter, 3, 2));
13866 func(at(iter, 3, 3));
13867 func(at(iter, 3, 4));
13868 func(at(iter, 4, 0));
13869 func(at(iter, 4, 1));
13870 func(at(iter, 4, 2));
13871 func(at(iter, 4, 3));
13872 func(at(iter, 4, 4));
13873 }
13874
13875 template<typename iterator_type_>
13876 LITE_INLINE
13877 typename detail::enable_if<(
13878 detail::g_iterator_policy<iterator_type_>::use_index
13879 ), bool>::type
13880 for_each_c(
13881 const iterator_type_& iter,
13882 const pack<constant<int, 5>, constant<int, 5> >&)
13883 {
13884 if (!at(iter, 0, 0)) return false;
13885 if (!at(iter, 0, 1)) return false;
13886 if (!at(iter, 0, 2)) return false;
13887 if (!at(iter, 0, 3)) return false;
13888 if (!at(iter, 0, 4)) return false;
13889 if (!at(iter, 1, 0)) return false;
13890 if (!at(iter, 1, 1)) return false;
13891 if (!at(iter, 1, 2)) return false;
13892 if (!at(iter, 1, 3)) return false;
13893 if (!at(iter, 1, 4)) return false;
13894 if (!at(iter, 2, 0)) return false;
13895 if (!at(iter, 2, 1)) return false;
13896 if (!at(iter, 2, 2)) return false;
13897 if (!at(iter, 2, 3)) return false;
13898 if (!at(iter, 2, 4)) return false;
13899 if (!at(iter, 3, 0)) return false;
13900 if (!at(iter, 3, 1)) return false;
13901 if (!at(iter, 3, 2)) return false;
13902 if (!at(iter, 3, 3)) return false;
13903 if (!at(iter, 3, 4)) return false;
13904 if (!at(iter, 4, 0)) return false;
13905 if (!at(iter, 4, 1)) return false;
13906 if (!at(iter, 4, 2)) return false;
13907 if (!at(iter, 4, 3)) return false;
13908 if (!at(iter, 4, 4)) return false;
13909 return true;
13910 }
13911
13912 template<typename iterator_type_, typename function_type_>
13913 LITE_INLINE
13914 typename detail::enable_if<(
13915 detail::g_iterator_policy<iterator_type_>::use_index
13916 ), bool>::type
13917 for_each_c(
13918 const iterator_type_& iter,
13919 function_type_& func,
13920 const pack<constant<int, 5>, constant<int, 5> >&)
13921 {
13922 if (!func(at(iter, 0, 0))) return false;
13923 if (!func(at(iter, 0, 1))) return false;
13924 if (!func(at(iter, 0, 2))) return false;
13925 if (!func(at(iter, 0, 3))) return false;
13926 if (!func(at(iter, 0, 4))) return false;
13927 if (!func(at(iter, 1, 0))) return false;
13928 if (!func(at(iter, 1, 1))) return false;
13929 if (!func(at(iter, 1, 2))) return false;
13930 if (!func(at(iter, 1, 3))) return false;
13931 if (!func(at(iter, 1, 4))) return false;
13932 if (!func(at(iter, 2, 0))) return false;
13933 if (!func(at(iter, 2, 1))) return false;
13934 if (!func(at(iter, 2, 2))) return false;
13935 if (!func(at(iter, 2, 3))) return false;
13936 if (!func(at(iter, 2, 4))) return false;
13937 if (!func(at(iter, 3, 0))) return false;
13938 if (!func(at(iter, 3, 1))) return false;
13939 if (!func(at(iter, 3, 2))) return false;
13940 if (!func(at(iter, 3, 3))) return false;
13941 if (!func(at(iter, 3, 4))) return false;
13942 if (!func(at(iter, 4, 0))) return false;
13943 if (!func(at(iter, 4, 1))) return false;
13944 if (!func(at(iter, 4, 2))) return false;
13945 if (!func(at(iter, 4, 3))) return false;
13946 if (!func(at(iter, 4, 4))) return false;
13947 return true;
13948 }
13949
13950
13951
13952
13953
13954 template<typename iterator_type_, typename size_type_>
13955 LITE_INLINE
13956 typename detail::enable_if<(
13957 size_type_::n > 1
13958 )>::type
13959 for_each(const iterator_type_& iter, const size_type_& size)
13960 {
13961 typedef size_transformer<plane<0>, size_type_> s_transformer;
13962 typedef iterator_transformer<plane<0>, iterator_type_, size_type_> i_transformer;
13963
13964 iterator_type_ it = iter;
13965 typename s_transformer::size_type new_size;
13966 typename i_transformer::iterator_type new_it;
13967 const int n = size.i0;
13968
13969 s_transformer::transform(size, new_size);
13970
13971 for (int i=0; i<n; i++) {
13972 i_transformer::transform(it, new_it);
13973 for_each(new_it, new_size);
13974 inc<0>(it);
13975 }
13976 }
13977
13978 template<typename iterator_type_, typename function_type_, typename size_type_>
13979 LITE_INLINE
13980 typename detail::enable_if<(
13981 size_type_::n > 1
13982 )>::type
13983 for_each(const iterator_type_& iter, function_type_& func, const size_type_& size)
13984 {
13985 typedef size_transformer<plane<0>, size_type_> s_transformer;
13986 typedef iterator_transformer<plane<0>, iterator_type_, size_type_> i_transformer;
13987
13988 iterator_type_ it = iter;
13989 typename s_transformer::size_type new_size;
13990 typename i_transformer::iterator_type new_it;
13991 const int n = size.i0;
13992
13993 s_transformer::transform(size, new_size);
13994
13995 for (int i=0; i<n; i++) {
13996 i_transformer::transform(it, new_it);
13997 for_each(new_it, func, new_size);
13998 inc<0>(it);
13999 }
14000 }
14001
14002 template<typename iterator_type_, typename size_type_>
14003 LITE_INLINE
14004 typename detail::enable_if<(
14005 size_type_::n > 1
14006 ), bool>::type
14007 for_each_c(const iterator_type_& iter, const size_type_& size)
14008 {
14009 typedef size_transformer<plane<0>, size_type_> s_transformer;
14010 typedef iterator_transformer<plane<0>, iterator_type_, size_type_> i_transformer;
14011
14012 iterator_type_ it = iter;
14013 typename s_transformer::size_type new_size;
14014 typename i_transformer::iterator_type new_it;
14015 const int n = size.i0;
14016
14017 s_transformer::transform(size, new_size);
14018
14019 for (int i=0; i<n; i++) {
14020 i_transformer::transform(it, new_it);
14021 if (!for_each_c(new_it, new_size))
14022 return false;
14023 inc<0>(it);
14024 }
14025 return true;
14026 }
14027
14028
14029 template<typename iterator_type_, typename function_type_, typename size_type_>
14030 LITE_INLINE
14031 typename detail::enable_if<(
14032 size_type_::n > 1
14033 ), bool>::type
14034 for_each_c(const iterator_type_& iter, function_type_& func, const size_type_& size)
14035 {
14036 typedef size_transformer<plane<0>, size_type_> s_transformer;
14037 typedef iterator_transformer<plane<0>, iterator_type_, size_type_> i_transformer;
14038
14039 iterator_type_ it = iter;
14040 typename s_transformer::size_type new_size;
14041 typename i_transformer::iterator_type new_it;
14042 const int n = size.i0;
14043
14044 s_transformer::transform(size, new_size);
14045
14046 for (int i=0; i<n; i++) {
14047 i_transformer::transform(it, new_it);
14048 if (!for_each_c(new_it, func, new_size))
14049 return false;
14050 inc<0>(it);
14051 }
14052 return true;
14053 }
14054
14055 #endif // !DOCUMENTATION_ONLY
14056
14057
14058
14059
14060
14066 template<typename signature_, typename traits_type_, typename rep_>
14067 LITE_INLINE void for_each(const array<signature_, traits_type_, rep_>& a)
14068 {
14069 for_each(a.begin(), a.size());
14070 }
14071
14077 template<typename signature_, typename traits_type_, typename rep_>
14078 LITE_INLINE void for_each(array<signature_, traits_type_, rep_>& a)
14079 {
14080 for_each(a.begin(), a.size());
14081 }
14082
14089 template<typename signature_, typename traits_type_, typename rep_, typename function_type_>
14090 LITE_INLINE void for_each(const array<signature_, traits_type_, rep_>& a, function_type_& func)
14091 {
14092 for_each(a.begin(), func, a.size());
14093 }
14094
14101 template<typename signature_, typename traits_type_, typename rep_, typename function_type_>
14102 LITE_INLINE void for_each(array<signature_, traits_type_, rep_>& a, function_type_& func)
14103 {
14104 for_each(a.begin(), func, a.size());
14105 }
14106
14114 template<typename signature_, typename traits_type_, typename rep_>
14115 LITE_INLINE bool for_each_c(const array<signature_, traits_type_, rep_>& a)
14116 {
14117 return for_each_c(a.begin(), a.size());
14118 }
14119
14127 template<typename signature_, typename traits_type_, typename rep_>
14128 LITE_INLINE bool for_each_c(array<signature_, traits_type_, rep_>& a)
14129 {
14130 return for_each_c(a.begin(), a.size());
14131 }
14132
14141 template<typename signature_, typename traits_type_, typename rep_, typename function_type_>
14142 LITE_INLINE bool for_each_c(const array<signature_, traits_type_, rep_>& a, function_type_& func)
14143 {
14144 return for_each_c(a.begin(), func, a.size());
14145 }
14146
14155 template<typename signature_, typename traits_type_, typename rep_, typename function_type_>
14156 LITE_INLINE bool for_each_c(array<signature_, traits_type_, rep_>& a, function_type_& func)
14157 {
14158 return for_each_c(a.begin(), func, a.size());
14159 }
14160
14161
14162
14163
14164
14171 struct default_array_traits
14172 {
14173 template<typename signature_>
14174 struct representation_type
14175 {
14176 typedef array_signature_traits<signature_> array_details;
14177
14178 typedef typename detail::type_if<
14179 (array_details::volume <= 4096 && array_details::is_fixed_size),
14180 internal_rep<false>,
14181 hybrid_rep<false, (array_details::volume <= 64 ? 64 : 1)>
14182 >::type type;
14183
14184 typedef typename detail::type_if<
14185 (array_details::volume <= 4096 && array_details::is_fixed_size),
14186 internal_rep<false>,
14187 hybrid_rep<false, (array_details::volume <= 4096 ? 4096 : 1)>
14188 >::type temporary_type;
14189
14190 typedef typename detail::type_if<
14191 (array_details::volume <= 4096 && array_details::is_fixed_size),
14192 internal_rep<false>,
14193 hybrid_rep<false, (array_details::volume <= 4096 ? 4096 : 1)>
14194 >::type fwd_temporary_type;
14195
14196 typedef typename detail::type_if<
14197 (array_details::volume <= 4096 && array_details::is_fixed_size),
14198 internal_rep<true>,
14199 hybrid_rep<true, (array_details::volume <= 4096 ? 4096 : 1)>
14200 >::type rev_temporary_type;
14201 };
14202 };
14203
14204
14205
14206
14207
14208 template<typename signature_, typename traits_type_, typename src_rep_>
14209 LITE_INLINE
14210 typename array<signature_, traits_type_, src_rep_>::temporary_array
14211 copy(const array<signature_, traits_type_, src_rep_>& src)
14212 {
14213 return src;
14214 }
14215
14216
14217
14218
14219
14220 #ifdef DOCUMENTATION_ONLY
14221
14239 template<typename size_type_>
14240 int volume(const size_type_& sz);
14241
14242 #else // DOCUMENTATION_ONLY
14243
14244 LITE_INLINE int volume(const pack<>&)
14245 {
14246 return 1;
14247 }
14248
14249 template<
14250 typename type0_
14251 >
14252 LITE_INLINE int
14253 volume(
14254 const pack<
14255 type0_
14256 >& size)
14257 {
14258 return size.i0;
14259 LITE_ARRAY_USE(size);
14260 }
14261
14262 template<
14263 typename type0_,
14264 typename type1_
14265 >
14266 LITE_INLINE int
14267 volume(
14268 const pack<
14269 type0_,
14270 type1_
14271 >& size)
14272 {
14273 return size.i0*size.i1;
14274 LITE_ARRAY_USE(size);
14275 }
14276
14277 template<
14278 typename type0_,
14279 typename type1_,
14280 typename type2_
14281 >
14282 LITE_INLINE int
14283 volume(
14284 const pack<
14285 type0_,
14286 type1_,
14287 type2_
14288 >& size)
14289 {
14290 return size.i0*size.i1*size.i2;
14291 LITE_ARRAY_USE(size);
14292 }
14293
14294
14295
14296 #endif // DOCUMENTATION_ONLY
14297
14298
14299
14300
14301
14302
14303 template<typename type_>
14304 class assign;
14305
14306
14307 template<typename type_>
14308 class swapper;
14309
14310 #ifdef DOCUMENTATION_ONLY
14311
14322 template<
14323 typename signature_,
14324 typename traits_type_ = default_array_traits,
14325 typename rep_ = typename traits_type_::template representation_type<signature_>::type>
14326 class array
14327 {
14328 public:
14329 typedef signature_ signature;
14330 typedef traits_type_ traits_type;
14331 typedef ... value_type;
14332 typedef ... iterator;
14333 typedef ... const_iterator;
14334 typedef ... reference;
14335 typedef ... const_reference;
14336
14337
14343 typedef ... temporary_array;
14344
14350 typedef ... fwd_temporary_array;
14351
14357 typedef ... rev_temporary_array;
14358
14360 typedef ... size_type;
14361
14363 static const int dimensions = ...;
14364
14369 static const bool is_reverse = ...;
14370
14379 array();
14380
14385 array(const array& other);
14386
14397 template<typename other_rep_>
14398 array(const array<signature_, traits_type_, other_rep_>& other);
14399
14408 explicit array(int n0, ..., int nN);
14409
14416 explicit array(const size_type& size);
14417
14434 array(const value_type& a0, ..., const value_type& aT);
14435
14448 template<typename arg_type0_, ..., typename arg_typeK_>
14449 array(const arg_type0_& arg0, ..., const arg_typeK_& argK, const size_type& sz);
14450
14461 template<typename other_iterator_type_, typename other_size_type_, typename transform_type_>
14462 array(
14463 const other_iterator_type_& it,
14464 const other_size_type_& sz,
14465 const transform_type_& trans);
14466
14467
14475 array& operator=(const array& other);
14476
14486 template<typename other_rep_>
14487 array& operator=(const array<signature_, traits_type_, other_rep_>& other);
14488
14490 const_iterator begin() const;
14491
14493 iterator begin();
14494
14496 size_type size() const;
14497
14499 const_reference operator()(int i0, ..., int iN) const;
14500
14502 reference operator()(int i0, ..., int iN);
14503
14509 const_reference operator[](int i0) const;
14510
14516 reference operator[](int i0);
14517
14525 template<typename transform_type_>
14526 const typename transform_traits<array, transform_type_>::const_array
14527 operator[](const transform_type_& trans) const;
14528
14536 template<typename transform_type_>
14537 const typename transform_traits<array, transform_type_>::array
14538 operator[](const transform_type_& trans);
14539
14549 const value_type* data() const;
14550
14560 value_type* data();
14561
14577 void resize(int n0, ..., int nN);
14578
14592 void resize(const size_type& sz);
14593
14602 void release();
14603 };
14604
14605 #endif // DOCUMENTATION_ONLY
14606
14607
14608
14609
14610
14618 template<typename iterator_type_>
14619 class reference_rep {};
14620
14621
14622 template<
14623 typename value_type_,
14624 typename traits_type_,
14625 typename iterator_
14626 >
14627 class array<
14628 value_type_,
14629 traits_type_,
14630 reference_rep<iterator_>
14631 >
14632 {
14633 public:
14634 typedef value_type_ signature;
14635 typedef traits_type_ traits_type;
14636 typedef value_type_ value_type;
14637 typedef iterator_ iterator;
14638 typedef iterator_ const_iterator;
14639 typedef typename std::iterator_traits<iterator>::reference reference;
14640 typedef reference const_reference;
14641
14642 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
14643 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
14644 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
14645
14646 typedef typename array_signature_traits<signature>::size_type size_type;
14647
14648 static const int dimensions = 0;
14649
14650 LITE_INLINE array(const array& other)
14651 : m_iterator(other.m_iterator), m_size(other.m_size)
14652 {}
14653
14654 template<typename other_rep_>
14655 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
14656 : m_iterator(other.begin()), m_size(other.size())
14657 {}
14658
14659 template<typename other_rep_>
14660 LITE_INLINE array(array<signature, traits_type_, other_rep_>& other)
14661 : m_iterator(other.begin()), m_size(other.size())
14662 {}
14663
14664 template<
14665 typename arg_type0_
14666 >
14667 LITE_INLINE array(
14668 const arg_type0_& arg0,
14669 const size_type& sz)
14670 : m_iterator(arg0),
14671 m_size(sz)
14672 {}
14673
14674 template<
14675 typename arg_type0_,
14676 typename arg_type1_
14677 >
14678 LITE_INLINE array(
14679 const arg_type0_& arg0,
14680 const arg_type1_& arg1,
14681 const size_type& sz)
14682 : m_iterator(arg0, arg1),
14683 m_size(sz)
14684 {}
14685
14686 template<
14687 typename arg_type0_,
14688 typename arg_type1_,
14689 typename arg_type2_
14690 >
14691 LITE_INLINE array(
14692 const arg_type0_& arg0,
14693 const arg_type1_& arg1,
14694 const arg_type2_& arg2,
14695 const size_type& sz)
14696 : m_iterator(arg0, arg1, arg2),
14697 m_size(sz)
14698 {}
14699
14700
14701 template<typename other_iterator_type_, typename other_size_type_, typename transform_type_>
14702 LITE_INLINE array(
14703 const other_iterator_type_& it,
14704 const other_size_type_& sz,
14705 const transform_type_& trans)
14706 {
14707 iterator_transformer<transform_type_, other_iterator_type_, other_size_type_>
14708 ::transform(trans, it, sz, m_iterator);
14709
14710 size_transformer<transform_type_, other_size_type_>
14711 ::transform(trans, sz, m_size);
14712 }
14713
14714 LITE_INLINE const array& operator=(const array& other) const
14715 {
14716 typedef b_iterator<iterator, iterator, assign<value_type> > iterator_type;
14717
14718 LITE_ARRAY_SIZE_CHECK(m_size, other.m_size, "operator=(): array sizes do not match");
14719
14720 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
14721 return *this;
14722 }
14723
14724 template<typename other_rep_>
14725 LITE_INLINE const array& operator=(const array<signature, traits_type_, other_rep_>& other) const
14726 {
14727 typedef b_iterator<
14728 iterator,
14729 typename array<signature, traits_type_, other_rep_>::const_iterator,
14730 assign<value_type> >
14731 iterator_type;
14732
14733 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "operator=(): array sizes do not match");
14734
14735 for_each(iterator_type(m_iterator, other.begin()), m_size);
14736 return *this;
14737 }
14738
14739 LITE_INLINE const array& operator=(const value_type& value) const
14740 {
14741 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
14742
14743 for_each(iterator_type(m_iterator, value), m_size);
14744 return *this;
14745 }
14746
14747 LITE_INLINE const iterator& begin() const
14748 {
14749 return m_iterator;
14750 }
14751
14752 LITE_INLINE const size_type& size() const
14753 {
14754 return m_size;
14755 }
14756
14757 LITE_INLINE reference
14758 operator()() const
14759 {
14760 return at(m_iterator);
14761 }
14762
14763 template<typename transform_type_>
14764 LITE_INLINE const typename transform_traits<array, transform_type_>::array
14765 operator[](const transform_type_& trans) const
14766 {
14767 typedef typename transform_traits<array, transform_type_>::array result_type;
14768
14769 return result_type(m_iterator, m_size, trans);
14770 }
14771
14772 template<typename other_rep_>
14773 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other) const
14774 {
14775 typedef b_iterator<
14776 iterator,
14777 typename array<signature, traits_type_, other_rep_>::const_iterator,
14778 swapper<value_type> >
14779 iterator_type;
14780
14781 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "swap(): array sizes do not match");
14782
14783 for_each(iterator_type(m_iterator, other.begin()), m_size);
14784 }
14785
14786 template<typename other_rep_>
14787 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other) const
14788 {
14789 typedef b_iterator<
14790 iterator,
14791 typename array<signature, traits_type_, other_rep_>::iterator,
14792 swapper<value_type> >
14793 iterator_type;
14794
14795 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "swap(): array sizes do not match");
14796
14797 for_each(iterator_type(m_iterator, other.begin()), m_size);
14798 }
14799
14800 private:
14801 iterator m_iterator;
14802 size_type m_size;
14803 };
14804
14805
14806
14807 template<
14808 typename value_type_,
14809 int n0_,
14810 typename traits_type_,
14811 typename iterator_
14812 >
14813 class array<
14814 value_type_[n0_],
14815 traits_type_,
14816 reference_rep<iterator_>
14817 >
14818 {
14819 public:
14820 typedef value_type_ signature[n0_];
14821 typedef traits_type_ traits_type;
14822 typedef value_type_ value_type;
14823 typedef iterator_ iterator;
14824 typedef iterator_ const_iterator;
14825 typedef typename std::iterator_traits<iterator>::reference reference;
14826 typedef reference const_reference;
14827
14828 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
14829 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
14830 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
14831
14832 typedef typename array_signature_traits<signature>::size_type size_type;
14833
14834 static const int dimensions = 1;
14835
14836 LITE_INLINE array(const array& other)
14837 : m_iterator(other.m_iterator), m_size(other.m_size)
14838 {}
14839
14840 template<typename other_rep_>
14841 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
14842 : m_iterator(other.begin()), m_size(other.size())
14843 {}
14844
14845 template<typename other_rep_>
14846 LITE_INLINE array(array<signature, traits_type_, other_rep_>& other)
14847 : m_iterator(other.begin()), m_size(other.size())
14848 {}
14849
14850 template<
14851 typename arg_type0_
14852 >
14853 LITE_INLINE array(
14854 const arg_type0_& arg0,
14855 const size_type& sz)
14856 : m_iterator(arg0),
14857 m_size(sz)
14858 {}
14859
14860 template<
14861 typename arg_type0_,
14862 typename arg_type1_
14863 >
14864 LITE_INLINE array(
14865 const arg_type0_& arg0,
14866 const arg_type1_& arg1,
14867 const size_type& sz)
14868 : m_iterator(arg0, arg1),
14869 m_size(sz)
14870 {}
14871
14872 template<
14873 typename arg_type0_,
14874 typename arg_type1_,
14875 typename arg_type2_
14876 >
14877 LITE_INLINE array(
14878 const arg_type0_& arg0,
14879 const arg_type1_& arg1,
14880 const arg_type2_& arg2,
14881 const size_type& sz)
14882 : m_iterator(arg0, arg1, arg2),
14883 m_size(sz)
14884 {}
14885
14886
14887 template<typename other_iterator_type_, typename other_size_type_, typename transform_type_>
14888 LITE_INLINE array(
14889 const other_iterator_type_& it,
14890 const other_size_type_& sz,
14891 const transform_type_& trans)
14892 {
14893 iterator_transformer<transform_type_, other_iterator_type_, other_size_type_>
14894 ::transform(trans, it, sz, m_iterator);
14895
14896 size_transformer<transform_type_, other_size_type_>
14897 ::transform(trans, sz, m_size);
14898 }
14899
14900 LITE_INLINE const array& operator=(const array& other) const
14901 {
14902 typedef b_iterator<iterator, iterator, assign<value_type> > iterator_type;
14903
14904 LITE_ARRAY_SIZE_CHECK(m_size, other.m_size, "operator=(): array sizes do not match");
14905
14906 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
14907 return *this;
14908 }
14909
14910 template<typename other_rep_>
14911 LITE_INLINE const array& operator=(const array<signature, traits_type_, other_rep_>& other) const
14912 {
14913 typedef b_iterator<
14914 iterator,
14915 typename array<signature, traits_type_, other_rep_>::const_iterator,
14916 assign<value_type> >
14917 iterator_type;
14918
14919 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "operator=(): array sizes do not match");
14920
14921 for_each(iterator_type(m_iterator, other.begin()), m_size);
14922 return *this;
14923 }
14924
14925 LITE_INLINE const array& operator=(const value_type& value) const
14926 {
14927 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
14928
14929 for_each(iterator_type(m_iterator, value), m_size);
14930 return *this;
14931 }
14932
14933 LITE_INLINE const iterator& begin() const
14934 {
14935 return m_iterator;
14936 }
14937
14938 LITE_INLINE const size_type& size() const
14939 {
14940 return m_size;
14941 }
14942
14943 LITE_INLINE reference
14944 operator()(int i0) const
14945 {
14946 return at(m_iterator, i0);
14947 }
14948
14949 LITE_INLINE reference
14950 operator[](int i0) const
14951 {
14952 return at(m_iterator, i0);
14953 }
14954
14955 template<typename transform_type_>
14956 LITE_INLINE const typename transform_traits<array, transform_type_>::array
14957 operator[](const transform_type_& trans) const
14958 {
14959 typedef typename transform_traits<array, transform_type_>::array result_type;
14960
14961 return result_type(m_iterator, m_size, trans);
14962 }
14963
14964 template<typename other_rep_>
14965 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other) const
14966 {
14967 typedef b_iterator<
14968 iterator,
14969 typename array<signature, traits_type_, other_rep_>::const_iterator,
14970 swapper<value_type> >
14971 iterator_type;
14972
14973 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "swap(): array sizes do not match");
14974
14975 for_each(iterator_type(m_iterator, other.begin()), m_size);
14976 }
14977
14978 template<typename other_rep_>
14979 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other) const
14980 {
14981 typedef b_iterator<
14982 iterator,
14983 typename array<signature, traits_type_, other_rep_>::iterator,
14984 swapper<value_type> >
14985 iterator_type;
14986
14987 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "swap(): array sizes do not match");
14988
14989 for_each(iterator_type(m_iterator, other.begin()), m_size);
14990 }
14991
14992 private:
14993 iterator m_iterator;
14994 size_type m_size;
14995 };
14996
14997
14998
14999 template<
15000 typename value_type_,
15001 int n0_,
15002 int n1_,
15003 typename traits_type_,
15004 typename iterator_
15005 >
15006 class array<
15007 value_type_[n0_][n1_],
15008 traits_type_,
15009 reference_rep<iterator_>
15010 >
15011 {
15012 public:
15013 typedef value_type_ signature[n0_][n1_];
15014 typedef traits_type_ traits_type;
15015 typedef value_type_ value_type;
15016 typedef iterator_ iterator;
15017 typedef iterator_ const_iterator;
15018 typedef typename std::iterator_traits<iterator>::reference reference;
15019 typedef reference const_reference;
15020
15021 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
15022 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
15023 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
15024
15025 typedef typename array_signature_traits<signature>::size_type size_type;
15026
15027 static const int dimensions = 2;
15028
15029 LITE_INLINE array(const array& other)
15030 : m_iterator(other.m_iterator), m_size(other.m_size)
15031 {}
15032
15033 template<typename other_rep_>
15034 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
15035 : m_iterator(other.begin()), m_size(other.size())
15036 {}
15037
15038 template<typename other_rep_>
15039 LITE_INLINE array(array<signature, traits_type_, other_rep_>& other)
15040 : m_iterator(other.begin()), m_size(other.size())
15041 {}
15042
15043 template<
15044 typename arg_type0_
15045 >
15046 LITE_INLINE array(
15047 const arg_type0_& arg0,
15048 const size_type& sz)
15049 : m_iterator(arg0),
15050 m_size(sz)
15051 {}
15052
15053 template<
15054 typename arg_type0_,
15055 typename arg_type1_
15056 >
15057 LITE_INLINE array(
15058 const arg_type0_& arg0,
15059 const arg_type1_& arg1,
15060 const size_type& sz)
15061 : m_iterator(arg0, arg1),
15062 m_size(sz)
15063 {}
15064
15065 template<
15066 typename arg_type0_,
15067 typename arg_type1_,
15068 typename arg_type2_
15069 >
15070 LITE_INLINE array(
15071 const arg_type0_& arg0,
15072 const arg_type1_& arg1,
15073 const arg_type2_& arg2,
15074 const size_type& sz)
15075 : m_iterator(arg0, arg1, arg2),
15076 m_size(sz)
15077 {}
15078
15079
15080 template<typename other_iterator_type_, typename other_size_type_, typename transform_type_>
15081 LITE_INLINE array(
15082 const other_iterator_type_& it,
15083 const other_size_type_& sz,
15084 const transform_type_& trans)
15085 {
15086 iterator_transformer<transform_type_, other_iterator_type_, other_size_type_>
15087 ::transform(trans, it, sz, m_iterator);
15088
15089 size_transformer<transform_type_, other_size_type_>
15090 ::transform(trans, sz, m_size);
15091 }
15092
15093 LITE_INLINE const array& operator=(const array& other) const
15094 {
15095 typedef b_iterator<iterator, iterator, assign<value_type> > iterator_type;
15096
15097 LITE_ARRAY_SIZE_CHECK(m_size, other.m_size, "operator=(): array sizes do not match");
15098
15099 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
15100 return *this;
15101 }
15102
15103 template<typename other_rep_>
15104 LITE_INLINE const array& operator=(const array<signature, traits_type_, other_rep_>& other) const
15105 {
15106 typedef b_iterator<
15107 iterator,
15108 typename array<signature, traits_type_, other_rep_>::const_iterator,
15109 assign<value_type> >
15110 iterator_type;
15111
15112 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "operator=(): array sizes do not match");
15113
15114 for_each(iterator_type(m_iterator, other.begin()), m_size);
15115 return *this;
15116 }
15117
15118 LITE_INLINE const array& operator=(const value_type& value) const
15119 {
15120 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
15121
15122 for_each(iterator_type(m_iterator, value), m_size);
15123 return *this;
15124 }
15125
15126 LITE_INLINE const iterator& begin() const
15127 {
15128 return m_iterator;
15129 }
15130
15131 LITE_INLINE const size_type& size() const
15132 {
15133 return m_size;
15134 }
15135
15136 LITE_INLINE reference
15137 operator()(int i0, int i1) const
15138 {
15139 return at(m_iterator, i0, i1);
15140 }
15141
15142 template<typename transform_type_>
15143 LITE_INLINE const typename transform_traits<array, transform_type_>::array
15144 operator[](const transform_type_& trans) const
15145 {
15146 typedef typename transform_traits<array, transform_type_>::array result_type;
15147
15148 return result_type(m_iterator, m_size, trans);
15149 }
15150
15151 template<typename other_rep_>
15152 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other) const
15153 {
15154 typedef b_iterator<
15155 iterator,
15156 typename array<signature, traits_type_, other_rep_>::const_iterator,
15157 swapper<value_type> >
15158 iterator_type;
15159
15160 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "swap(): array sizes do not match");
15161
15162 for_each(iterator_type(m_iterator, other.begin()), m_size);
15163 }
15164
15165 template<typename other_rep_>
15166 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other) const
15167 {
15168 typedef b_iterator<
15169 iterator,
15170 typename array<signature, traits_type_, other_rep_>::iterator,
15171 swapper<value_type> >
15172 iterator_type;
15173
15174 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "swap(): array sizes do not match");
15175
15176 for_each(iterator_type(m_iterator, other.begin()), m_size);
15177 }
15178
15179 private:
15180 iterator m_iterator;
15181 size_type m_size;
15182 };
15183
15184
15185
15186 template<
15187 typename value_type_,
15188 int n0_,
15189 int n1_,
15190 int n2_,
15191 typename traits_type_,
15192 typename iterator_
15193 >
15194 class array<
15195 value_type_[n0_][n1_][n2_],
15196 traits_type_,
15197 reference_rep<iterator_>
15198 >
15199 {
15200 public:
15201 typedef value_type_ signature[n0_][n1_][n2_];
15202 typedef traits_type_ traits_type;
15203 typedef value_type_ value_type;
15204 typedef iterator_ iterator;
15205 typedef iterator_ const_iterator;
15206 typedef typename std::iterator_traits<iterator>::reference reference;
15207 typedef reference const_reference;
15208
15209 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
15210 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
15211 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
15212
15213 typedef typename array_signature_traits<signature>::size_type size_type;
15214
15215 static const int dimensions = 3;
15216
15217 LITE_INLINE array(const array& other)
15218 : m_iterator(other.m_iterator), m_size(other.m_size)
15219 {}
15220
15221 template<typename other_rep_>
15222 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
15223 : m_iterator(other.begin()), m_size(other.size())
15224 {}
15225
15226 template<typename other_rep_>
15227 LITE_INLINE array(array<signature, traits_type_, other_rep_>& other)
15228 : m_iterator(other.begin()), m_size(other.size())
15229 {}
15230
15231 template<
15232 typename arg_type0_
15233 >
15234 LITE_INLINE array(
15235 const arg_type0_& arg0,
15236 const size_type& sz)
15237 : m_iterator(arg0),
15238 m_size(sz)
15239 {}
15240
15241 template<
15242 typename arg_type0_,
15243 typename arg_type1_
15244 >
15245 LITE_INLINE array(
15246 const arg_type0_& arg0,
15247 const arg_type1_& arg1,
15248 const size_type& sz)
15249 : m_iterator(arg0, arg1),
15250 m_size(sz)
15251 {}
15252
15253 template<
15254 typename arg_type0_,
15255 typename arg_type1_,
15256 typename arg_type2_
15257 >
15258 LITE_INLINE array(
15259 const arg_type0_& arg0,
15260 const arg_type1_& arg1,
15261 const arg_type2_& arg2,
15262 const size_type& sz)
15263 : m_iterator(arg0, arg1, arg2),
15264 m_size(sz)
15265 {}
15266
15267
15268 template<typename other_iterator_type_, typename other_size_type_, typename transform_type_>
15269 LITE_INLINE array(
15270 const other_iterator_type_& it,
15271 const other_size_type_& sz,
15272 const transform_type_& trans)
15273 {
15274 iterator_transformer<transform_type_, other_iterator_type_, other_size_type_>
15275 ::transform(trans, it, sz, m_iterator);
15276
15277 size_transformer<transform_type_, other_size_type_>
15278 ::transform(trans, sz, m_size);
15279 }
15280
15281 LITE_INLINE const array& operator=(const array& other) const
15282 {
15283 typedef b_iterator<iterator, iterator, assign<value_type> > iterator_type;
15284
15285 LITE_ARRAY_SIZE_CHECK(m_size, other.m_size, "operator=(): array sizes do not match");
15286
15287 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
15288 return *this;
15289 }
15290
15291 template<typename other_rep_>
15292 LITE_INLINE const array& operator=(const array<signature, traits_type_, other_rep_>& other) const
15293 {
15294 typedef b_iterator<
15295 iterator,
15296 typename array<signature, traits_type_, other_rep_>::const_iterator,
15297 assign<value_type> >
15298 iterator_type;
15299
15300 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "operator=(): array sizes do not match");
15301
15302 for_each(iterator_type(m_iterator, other.begin()), m_size);
15303 return *this;
15304 }
15305
15306 LITE_INLINE const array& operator=(const value_type& value) const
15307 {
15308 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
15309
15310 for_each(iterator_type(m_iterator, value), m_size);
15311 return *this;
15312 }
15313
15314 LITE_INLINE const iterator& begin() const
15315 {
15316 return m_iterator;
15317 }
15318
15319 LITE_INLINE const size_type& size() const
15320 {
15321 return m_size;
15322 }
15323
15324 LITE_INLINE reference
15325 operator()(int i0, int i1, int i2) const
15326 {
15327 return at(m_iterator, i0, i1, i2);
15328 }
15329
15330 template<typename transform_type_>
15331 LITE_INLINE const typename transform_traits<array, transform_type_>::array
15332 operator[](const transform_type_& trans) const
15333 {
15334 typedef typename transform_traits<array, transform_type_>::array result_type;
15335
15336 return result_type(m_iterator, m_size, trans);
15337 }
15338
15339 template<typename other_rep_>
15340 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other) const
15341 {
15342 typedef b_iterator<
15343 iterator,
15344 typename array<signature, traits_type_, other_rep_>::const_iterator,
15345 swapper<value_type> >
15346 iterator_type;
15347
15348 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "swap(): array sizes do not match");
15349
15350 for_each(iterator_type(m_iterator, other.begin()), m_size);
15351 }
15352
15353 template<typename other_rep_>
15354 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other) const
15355 {
15356 typedef b_iterator<
15357 iterator,
15358 typename array<signature, traits_type_, other_rep_>::iterator,
15359 swapper<value_type> >
15360 iterator_type;
15361
15362 LITE_ARRAY_SIZE_CHECK(m_size, other.size(), "swap(): array sizes do not match");
15363
15364 for_each(iterator_type(m_iterator, other.begin()), m_size);
15365 }
15366
15367 private:
15368 iterator m_iterator;
15369 size_type m_size;
15370 };
15371
15372
15373
15374
15375
15376
15377
15378
15386 template<bool reversed_>
15387 class internal_rep {};
15388
15389
15390 template<typename type_>
15391 class swapper;
15392
15393 template<
15394 typename value_type_,
15395 typename traits_type_
15396 >
15397 class array<
15398 value_type_,
15399 traits_type_,
15400 internal_rep<false>
15401 >
15402 {
15403 public:
15404 typedef value_type_ signature;
15405 typedef traits_type_ traits_type;
15406 typedef value_type_ value_type;
15407 typedef const value_type_& const_reference;
15408 typedef value_type_& reference;
15409
15410 typedef typename array_signature_traits<const signature>::default_iterator const_iterator;
15411 typedef typename array_signature_traits<signature>::default_iterator iterator;
15412 typedef typename array_signature_traits<signature>::size_type size_type;
15413
15414 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
15415 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
15416 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
15417
15418 static const bool is_reverse = false;
15419 static const int dimensions = 0;
15420
15421 LITE_INLINE array()
15422 {}
15423
15424
15425 explicit LITE_INLINE array(const size_type&)
15426 {}
15427
15428 LITE_INLINE array(const array& other)
15429 {
15430 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
15431
15432 for_each(iterator_type(
15433 &m_data,
15434 &other.m_data),
15435 size_type());
15436 }
15437
15438 template<typename other_rep_>
15439 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
15440 {
15441 typedef b_iterator<
15442 iterator,
15443 typename array<signature, traits_type_, other_rep_>::const_iterator,
15444 assign<value_type> >
15445 iterator_type;
15446
15447 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
15448
15449 for_each(iterator_type(&m_data, other.begin()), size_type());
15450 }
15451
15452 LITE_INLINE array(const value_type& value)
15453 {
15454 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
15455
15456 for_each(iterator_type(&m_data, value), size_type());
15457 }
15458
15459
15460 LITE_INLINE array& operator=(const array& other)
15461 {
15462 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
15463
15464 for_each(iterator_type(
15465 &m_data,
15466 &other.m_data),
15467 size_type());
15468 return *this;
15469 }
15470
15471 template<typename other_rep_>
15472 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
15473 {
15474 typedef b_iterator<
15475 iterator,
15476 typename array<signature, traits_type_, other_rep_>::const_iterator,
15477 assign<value_type> >
15478 iterator_type;
15479
15480 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
15481
15482 for_each(iterator_type(&m_data, other.begin()), size_type());
15483 return *this;
15484 }
15485
15486 LITE_INLINE array& operator=(const value_type& value)
15487 {
15488 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
15489
15490 for_each(iterator_type(&m_data, value), size_type());
15491 return *this;
15492 }
15493
15494 LITE_INLINE const_iterator begin() const
15495 {
15496 return const_iterator(&m_data);
15497 }
15498
15499 LITE_INLINE iterator begin()
15500 {
15501 return iterator(&m_data);
15502 }
15503
15504 LITE_INLINE size_type size() const
15505 {
15506 return size_type();
15507 }
15508
15509 LITE_INLINE const_reference
15510 operator()() const
15511 {
15512 return m_data;
15513 }
15514
15515 LITE_INLINE reference
15516 operator()()
15517 {
15518 return m_data;
15519 }
15520
15521
15522 template<typename transform_type_>
15523 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
15524 operator[](const transform_type_& trans) const
15525 {
15526 typedef typename transform_traits<array, transform_type_>::const_array result_type;
15527
15528 return result_type(begin(), size(), trans);
15529 }
15530
15531 template<typename transform_type_>
15532 LITE_INLINE const typename transform_traits<array, transform_type_>::array
15533 operator[](const transform_type_& trans)
15534 {
15535 typedef typename transform_traits<array, transform_type_>::array result_type;
15536
15537 return result_type(begin(), size(), trans);
15538 }
15539
15540 LITE_INLINE const value_type* data() const
15541 {
15542 return &m_data;
15543 }
15544
15545 LITE_INLINE value_type* data()
15546 {
15547 return &m_data;
15548 }
15549
15550 LITE_INLINE void release()
15551 {}
15552
15553 LITE_INLINE void resize()
15554 {}
15555
15556 LITE_INLINE void resize(const size_type&)
15557 {}
15558
15559 template<typename other_rep_>
15560 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
15561 {
15562 typedef b_iterator<
15563 iterator,
15564 typename array<signature, traits_type_, other_rep_>::const_iterator,
15565 swapper<value_type> >
15566 iterator_type;
15567
15568 for_each(iterator_type(&m_data, other.begin()), size_type());
15569 }
15570
15571 template<typename other_rep_>
15572 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
15573 {
15574 typedef b_iterator<
15575 iterator,
15576 typename array<signature, traits_type_, other_rep_>::iterator,
15577 swapper<value_type> >
15578 iterator_type;
15579
15580 for_each(iterator_type(&m_data, other.begin()), size_type());
15581 }
15582
15583 private:
15584 value_type m_data;
15585 };
15586
15587
15588
15589 template<
15590 typename value_type_,
15591 int n0_,
15592 typename traits_type_
15593 >
15594 class array<
15595 value_type_[n0_],
15596 traits_type_,
15597 internal_rep<false>
15598 >
15599 {
15600 public:
15601 typedef value_type_ signature[n0_];
15602 typedef traits_type_ traits_type;
15603 typedef value_type_ value_type;
15604 typedef const value_type_& const_reference;
15605 typedef value_type_& reference;
15606
15607 typedef typename array_signature_traits<const signature>::default_iterator const_iterator;
15608 typedef typename array_signature_traits<signature>::default_iterator iterator;
15609 typedef typename array_signature_traits<signature>::size_type size_type;
15610
15611 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
15612 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
15613 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
15614
15615 static const bool is_reverse = false;
15616 static const int dimensions = 1;
15617
15618 LITE_INLINE array()
15619 {}
15620
15621 explicit LITE_INLINE array(int)
15622 {}
15623
15624 explicit LITE_INLINE array(const size_type&)
15625 {}
15626
15627 LITE_INLINE array(const array& other)
15628 {
15629 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
15630
15631 for_each(iterator_type(
15632 &m_data[0],
15633 &other.m_data[0]),
15634 size_type());
15635 }
15636
15637 template<typename other_rep_>
15638 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
15639 {
15640 typedef b_iterator<
15641 iterator,
15642 typename array<signature, traits_type_, other_rep_>::const_iterator,
15643 assign<value_type> >
15644 iterator_type;
15645
15646 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
15647
15648 for_each(iterator_type(&m_data[0], other.begin()), size_type());
15649 }
15650
15651 LITE_INLINE array(const value_type& value)
15652 {
15653 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
15654
15655 for_each(iterator_type(&m_data[0], value), size_type());
15656 }
15657
15658
15659 LITE_INLINE array(
15660 typename detail::type_if<n0_==2, const value_type&, detail::invalid_argument>::type a0,
15661 const value_type& a1
15662 )
15663 {
15664 m_data[0] = a0;
15665 m_data[1] = a1;
15666 }
15667
15668 LITE_INLINE array(
15669 typename detail::type_if<n0_==3, const value_type&, detail::invalid_argument>::type a0,
15670 const value_type& a1,
15671 const value_type& a2
15672 )
15673 {
15674 m_data[0] = a0;
15675 m_data[1] = a1;
15676 m_data[2] = a2;
15677 }
15678
15679 LITE_INLINE array(
15680 typename detail::type_if<n0_==4, const value_type&, detail::invalid_argument>::type a0,
15681 const value_type& a1,
15682 const value_type& a2,
15683 const value_type& a3
15684 )
15685 {
15686 m_data[0] = a0;
15687 m_data[1] = a1;
15688 m_data[2] = a2;
15689 m_data[3] = a3;
15690 }
15691
15692 LITE_INLINE array(
15693 typename detail::type_if<n0_==5, const value_type&, detail::invalid_argument>::type a0,
15694 const value_type& a1,
15695 const value_type& a2,
15696 const value_type& a3,
15697 const value_type& a4
15698 )
15699 {
15700 m_data[0] = a0;
15701 m_data[1] = a1;
15702 m_data[2] = a2;
15703 m_data[3] = a3;
15704 m_data[4] = a4;
15705 }
15706
15707 LITE_INLINE array& operator=(const array& other)
15708 {
15709 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
15710
15711 for_each(iterator_type(
15712 &m_data[0],
15713 &other.m_data[0]),
15714 size_type());
15715 return *this;
15716 }
15717
15718 template<typename other_rep_>
15719 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
15720 {
15721 typedef b_iterator<
15722 iterator,
15723 typename array<signature, traits_type_, other_rep_>::const_iterator,
15724 assign<value_type> >
15725 iterator_type;
15726
15727 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
15728
15729 for_each(iterator_type(&m_data[0], other.begin()), size_type());
15730 return *this;
15731 }
15732
15733 LITE_INLINE array& operator=(const value_type& value)
15734 {
15735 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
15736
15737 for_each(iterator_type(&m_data[0], value), size_type());
15738 return *this;
15739 }
15740
15741 LITE_INLINE const_iterator begin() const
15742 {
15743 return const_iterator(&m_data[0]);
15744 }
15745
15746 LITE_INLINE iterator begin()
15747 {
15748 return iterator(&m_data[0]);
15749 }
15750
15751 LITE_INLINE size_type size() const
15752 {
15753 return size_type();
15754 }
15755
15756 LITE_INLINE const_reference
15757 operator()(int i0) const
15758 {
15759 return m_data[i0];
15760 }
15761
15762 LITE_INLINE reference
15763 operator()(int i0)
15764 {
15765 return m_data[i0];
15766 }
15767
15768 LITE_INLINE const_reference
15769 operator[](int i0) const
15770 {
15771 return m_data[i0];
15772 }
15773
15774 LITE_INLINE reference
15775 operator[](int i0)
15776 {
15777 return m_data[i0];
15778 }
15779
15780
15781 template<typename transform_type_>
15782 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
15783 operator[](const transform_type_& trans) const
15784 {
15785 typedef typename transform_traits<array, transform_type_>::const_array result_type;
15786
15787 return result_type(begin(), size(), trans);
15788 }
15789
15790 template<typename transform_type_>
15791 LITE_INLINE const typename transform_traits<array, transform_type_>::array
15792 operator[](const transform_type_& trans)
15793 {
15794 typedef typename transform_traits<array, transform_type_>::array result_type;
15795
15796 return result_type(begin(), size(), trans);
15797 }
15798
15799 LITE_INLINE const value_type* data() const
15800 {
15801 return &m_data[0];
15802 }
15803
15804 LITE_INLINE value_type* data()
15805 {
15806 return &m_data[0];
15807 }
15808
15809 LITE_INLINE void release()
15810 {}
15811
15812 LITE_INLINE void resize(int)
15813 {}
15814
15815 LITE_INLINE void resize(const size_type&)
15816 {}
15817
15818 template<typename other_rep_>
15819 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
15820 {
15821 typedef b_iterator<
15822 iterator,
15823 typename array<signature, traits_type_, other_rep_>::const_iterator,
15824 swapper<value_type> >
15825 iterator_type;
15826
15827 for_each(iterator_type(&m_data[0], other.begin()), size_type());
15828 }
15829
15830 template<typename other_rep_>
15831 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
15832 {
15833 typedef b_iterator<
15834 iterator,
15835 typename array<signature, traits_type_, other_rep_>::iterator,
15836 swapper<value_type> >
15837 iterator_type;
15838
15839 for_each(iterator_type(&m_data[0], other.begin()), size_type());
15840 }
15841
15842 private:
15843 value_type m_data[n0_];
15844 };
15845
15846
15847
15848 template<
15849 typename value_type_,
15850 int n0_,
15851 int n1_,
15852 typename traits_type_
15853 >
15854 class array<
15855 value_type_[n0_][n1_],
15856 traits_type_,
15857 internal_rep<false>
15858 >
15859 {
15860 public:
15861 typedef value_type_ signature[n0_][n1_];
15862 typedef traits_type_ traits_type;
15863 typedef value_type_ value_type;
15864 typedef const value_type_& const_reference;
15865 typedef value_type_& reference;
15866
15867 typedef typename array_signature_traits<const signature>::default_iterator const_iterator;
15868 typedef typename array_signature_traits<signature>::default_iterator iterator;
15869 typedef typename array_signature_traits<signature>::size_type size_type;
15870
15871 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
15872 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
15873 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
15874
15875 static const bool is_reverse = false;
15876 static const int dimensions = 2;
15877
15878 LITE_INLINE array()
15879 {}
15880
15881 explicit LITE_INLINE array(int, int)
15882 {}
15883
15884 explicit LITE_INLINE array(const size_type&)
15885 {}
15886
15887 LITE_INLINE array(const array& other)
15888 {
15889 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
15890
15891 for_each(iterator_type(
15892 &m_data[0][0],
15893 &other.m_data[0][0]),
15894 size_type());
15895 }
15896
15897 template<typename other_rep_>
15898 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
15899 {
15900 typedef b_iterator<
15901 iterator,
15902 typename array<signature, traits_type_, other_rep_>::const_iterator,
15903 assign<value_type> >
15904 iterator_type;
15905
15906 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
15907
15908 for_each(iterator_type(&m_data[0][0], other.begin()), size_type());
15909 }
15910
15911 LITE_INLINE array(const value_type& value)
15912 {
15913 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
15914
15915 for_each(iterator_type(&m_data[0][0], value), size_type());
15916 }
15917
15918
15919 LITE_INLINE array& operator=(const array& other)
15920 {
15921 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
15922
15923 for_each(iterator_type(
15924 &m_data[0][0],
15925 &other.m_data[0][0]),
15926 size_type());
15927 return *this;
15928 }
15929
15930 template<typename other_rep_>
15931 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
15932 {
15933 typedef b_iterator<
15934 iterator,
15935 typename array<signature, traits_type_, other_rep_>::const_iterator,
15936 assign<value_type> >
15937 iterator_type;
15938
15939 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
15940
15941 for_each(iterator_type(&m_data[0][0], other.begin()), size_type());
15942 return *this;
15943 }
15944
15945 LITE_INLINE array& operator=(const value_type& value)
15946 {
15947 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
15948
15949 for_each(iterator_type(&m_data[0][0], value), size_type());
15950 return *this;
15951 }
15952
15953 LITE_INLINE const_iterator begin() const
15954 {
15955 return const_iterator(&m_data[0][0]);
15956 }
15957
15958 LITE_INLINE iterator begin()
15959 {
15960 return iterator(&m_data[0][0]);
15961 }
15962
15963 LITE_INLINE size_type size() const
15964 {
15965 return size_type();
15966 }
15967
15968 LITE_INLINE const_reference
15969 operator()(int i0, int i1) const
15970 {
15971 return m_data[i0][i1];
15972 }
15973
15974 LITE_INLINE reference
15975 operator()(int i0, int i1)
15976 {
15977 return m_data[i0][i1];
15978 }
15979
15980
15981 template<typename transform_type_>
15982 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
15983 operator[](const transform_type_& trans) const
15984 {
15985 typedef typename transform_traits<array, transform_type_>::const_array result_type;
15986
15987 return result_type(begin(), size(), trans);
15988 }
15989
15990 template<typename transform_type_>
15991 LITE_INLINE const typename transform_traits<array, transform_type_>::array
15992 operator[](const transform_type_& trans)
15993 {
15994 typedef typename transform_traits<array, transform_type_>::array result_type;
15995
15996 return result_type(begin(), size(), trans);
15997 }
15998
15999 LITE_INLINE const value_type* data() const
16000 {
16001 return &m_data[0][0];
16002 }
16003
16004 LITE_INLINE value_type* data()
16005 {
16006 return &m_data[0][0];
16007 }
16008
16009 LITE_INLINE void release()
16010 {}
16011
16012 LITE_INLINE void resize(int, int)
16013 {}
16014
16015 LITE_INLINE void resize(const size_type&)
16016 {}
16017
16018 template<typename other_rep_>
16019 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
16020 {
16021 typedef b_iterator<
16022 iterator,
16023 typename array<signature, traits_type_, other_rep_>::const_iterator,
16024 swapper<value_type> >
16025 iterator_type;
16026
16027 for_each(iterator_type(&m_data[0][0], other.begin()), size_type());
16028 }
16029
16030 template<typename other_rep_>
16031 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
16032 {
16033 typedef b_iterator<
16034 iterator,
16035 typename array<signature, traits_type_, other_rep_>::iterator,
16036 swapper<value_type> >
16037 iterator_type;
16038
16039 for_each(iterator_type(&m_data[0][0], other.begin()), size_type());
16040 }
16041
16042 private:
16043 value_type m_data[n0_][n1_];
16044 };
16045
16046
16047
16048 template<
16049 typename value_type_,
16050 int n0_,
16051 int n1_,
16052 int n2_,
16053 typename traits_type_
16054 >
16055 class array<
16056 value_type_[n0_][n1_][n2_],
16057 traits_type_,
16058 internal_rep<false>
16059 >
16060 {
16061 public:
16062 typedef value_type_ signature[n0_][n1_][n2_];
16063 typedef traits_type_ traits_type;
16064 typedef value_type_ value_type;
16065 typedef const value_type_& const_reference;
16066 typedef value_type_& reference;
16067
16068 typedef typename array_signature_traits<const signature>::default_iterator const_iterator;
16069 typedef typename array_signature_traits<signature>::default_iterator iterator;
16070 typedef typename array_signature_traits<signature>::size_type size_type;
16071
16072 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
16073 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
16074 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
16075
16076 static const bool is_reverse = false;
16077 static const int dimensions = 3;
16078
16079 LITE_INLINE array()
16080 {}
16081
16082 explicit LITE_INLINE array(int, int, int)
16083 {}
16084
16085 explicit LITE_INLINE array(const size_type&)
16086 {}
16087
16088 LITE_INLINE array(const array& other)
16089 {
16090 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
16091
16092 for_each(iterator_type(
16093 &m_data[0][0][0],
16094 &other.m_data[0][0][0]),
16095 size_type());
16096 }
16097
16098 template<typename other_rep_>
16099 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
16100 {
16101 typedef b_iterator<
16102 iterator,
16103 typename array<signature, traits_type_, other_rep_>::const_iterator,
16104 assign<value_type> >
16105 iterator_type;
16106
16107 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
16108
16109 for_each(iterator_type(&m_data[0][0][0], other.begin()), size_type());
16110 }
16111
16112 LITE_INLINE array(const value_type& value)
16113 {
16114 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
16115
16116 for_each(iterator_type(&m_data[0][0][0], value), size_type());
16117 }
16118
16119
16120 LITE_INLINE array& operator=(const array& other)
16121 {
16122 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
16123
16124 for_each(iterator_type(
16125 &m_data[0][0][0],
16126 &other.m_data[0][0][0]),
16127 size_type());
16128 return *this;
16129 }
16130
16131 template<typename other_rep_>
16132 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
16133 {
16134 typedef b_iterator<
16135 iterator,
16136 typename array<signature, traits_type_, other_rep_>::const_iterator,
16137 assign<value_type> >
16138 iterator_type;
16139
16140 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
16141
16142 for_each(iterator_type(&m_data[0][0][0], other.begin()), size_type());
16143 return *this;
16144 }
16145
16146 LITE_INLINE array& operator=(const value_type& value)
16147 {
16148 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
16149
16150 for_each(iterator_type(&m_data[0][0][0], value), size_type());
16151 return *this;
16152 }
16153
16154 LITE_INLINE const_iterator begin() const
16155 {
16156 return const_iterator(&m_data[0][0][0]);
16157 }
16158
16159 LITE_INLINE iterator begin()
16160 {
16161 return iterator(&m_data[0][0][0]);
16162 }
16163
16164 LITE_INLINE size_type size() const
16165 {
16166 return size_type();
16167 }
16168
16169 LITE_INLINE const_reference
16170 operator()(int i0, int i1, int i2) const
16171 {
16172 return m_data[i0][i1][i2];
16173 }
16174
16175 LITE_INLINE reference
16176 operator()(int i0, int i1, int i2)
16177 {
16178 return m_data[i0][i1][i2];
16179 }
16180
16181
16182 template<typename transform_type_>
16183 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
16184 operator[](const transform_type_& trans) const
16185 {
16186 typedef typename transform_traits<array, transform_type_>::const_array result_type;
16187
16188 return result_type(begin(), size(), trans);
16189 }
16190
16191 template<typename transform_type_>
16192 LITE_INLINE const typename transform_traits<array, transform_type_>::array
16193 operator[](const transform_type_& trans)
16194 {
16195 typedef typename transform_traits<array, transform_type_>::array result_type;
16196
16197 return result_type(begin(), size(), trans);
16198 }
16199
16200 LITE_INLINE const value_type* data() const
16201 {
16202 return &m_data[0][0][0];
16203 }
16204
16205 LITE_INLINE value_type* data()
16206 {
16207 return &m_data[0][0][0];
16208 }
16209
16210 LITE_INLINE void release()
16211 {}
16212
16213 LITE_INLINE void resize(int, int, int)
16214 {}
16215
16216 LITE_INLINE void resize(const size_type&)
16217 {}
16218
16219 template<typename other_rep_>
16220 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
16221 {
16222 typedef b_iterator<
16223 iterator,
16224 typename array<signature, traits_type_, other_rep_>::const_iterator,
16225 swapper<value_type> >
16226 iterator_type;
16227
16228 for_each(iterator_type(&m_data[0][0][0], other.begin()), size_type());
16229 }
16230
16231 template<typename other_rep_>
16232 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
16233 {
16234 typedef b_iterator<
16235 iterator,
16236 typename array<signature, traits_type_, other_rep_>::iterator,
16237 swapper<value_type> >
16238 iterator_type;
16239
16240 for_each(iterator_type(&m_data[0][0][0], other.begin()), size_type());
16241 }
16242
16243 private:
16244 value_type m_data[n0_][n1_][n2_];
16245 };
16246
16247
16248
16249 template<
16250 typename value_type_,
16251 typename traits_type_
16252 >
16253 class array<
16254 value_type_,
16255 traits_type_,
16256 internal_rep<true>
16257 >
16258 {
16259 public:
16260 typedef value_type_ signature;
16261 typedef traits_type_ traits_type;
16262 typedef value_type_ value_type;
16263 typedef const value_type_& const_reference;
16264 typedef value_type_& reference;
16265
16266 typedef typename array_signature_traits<const signature>::default_rev_iterator const_iterator;
16267 typedef typename array_signature_traits<signature>::default_rev_iterator iterator;
16268 typedef typename array_signature_traits<signature>::size_type size_type;
16269
16270 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
16271 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
16272 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
16273
16274 static const bool is_reverse = true;
16275 static const int dimensions = 0;
16276
16277 LITE_INLINE array()
16278 {}
16279
16280
16281 explicit LITE_INLINE array(const size_type&)
16282 {}
16283
16284 LITE_INLINE array(const array& other)
16285 {
16286 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
16287
16288 for_each(iterator_type(
16289 &m_data,
16290 &other.m_data),
16291 size_type());
16292 }
16293
16294 template<typename other_rep_>
16295 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
16296 {
16297 typedef b_iterator<
16298 iterator,
16299 typename array<signature, traits_type_, other_rep_>::const_iterator,
16300 assign<value_type> >
16301 iterator_type;
16302
16303 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
16304
16305 for_each(iterator_type(&m_data, other.begin()), size_type());
16306 }
16307
16308 LITE_INLINE array(const value_type& value)
16309 {
16310 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
16311
16312 for_each(iterator_type(&m_data, value), size_type());
16313 }
16314
16315
16316 LITE_INLINE array& operator=(const array& other)
16317 {
16318 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
16319
16320 for_each(iterator_type(
16321 &m_data,
16322 &other.m_data),
16323 size_type());
16324 return *this;
16325 }
16326
16327 template<typename other_rep_>
16328 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
16329 {
16330 typedef b_iterator<
16331 iterator,
16332 typename array<signature, traits_type_, other_rep_>::const_iterator,
16333 assign<value_type> >
16334 iterator_type;
16335
16336 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
16337
16338 for_each(iterator_type(&m_data, other.begin()), size_type());
16339 return *this;
16340 }
16341
16342 LITE_INLINE array& operator=(const value_type& value)
16343 {
16344 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
16345
16346 for_each(iterator_type(&m_data, value), size_type());
16347 return *this;
16348 }
16349
16350 LITE_INLINE const_iterator begin() const
16351 {
16352 return const_iterator(&m_data);
16353 }
16354
16355 LITE_INLINE iterator begin()
16356 {
16357 return iterator(&m_data);
16358 }
16359
16360 LITE_INLINE size_type size() const
16361 {
16362 return size_type();
16363 }
16364
16365 LITE_INLINE const_reference
16366 operator()() const
16367 {
16368 return m_data;
16369 }
16370
16371 LITE_INLINE reference
16372 operator()()
16373 {
16374 return m_data;
16375 }
16376
16377
16378 template<typename transform_type_>
16379 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
16380 operator[](const transform_type_& trans) const
16381 {
16382 typedef typename transform_traits<array, transform_type_>::const_array result_type;
16383
16384 return result_type(begin(), size(), trans);
16385 }
16386
16387 template<typename transform_type_>
16388 LITE_INLINE const typename transform_traits<array, transform_type_>::array
16389 operator[](const transform_type_& trans)
16390 {
16391 typedef typename transform_traits<array, transform_type_>::array result_type;
16392
16393 return result_type(begin(), size(), trans);
16394 }
16395
16396 LITE_INLINE const value_type* data() const
16397 {
16398 return &m_data;
16399 }
16400
16401 LITE_INLINE value_type* data()
16402 {
16403 return &m_data;
16404 }
16405
16406 LITE_INLINE void release()
16407 {}
16408
16409 LITE_INLINE void resize()
16410 {}
16411
16412 LITE_INLINE void resize(const size_type&)
16413 {}
16414
16415 template<typename other_rep_>
16416 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
16417 {
16418 typedef b_iterator<
16419 iterator,
16420 typename array<signature, traits_type_, other_rep_>::const_iterator,
16421 swapper<value_type> >
16422 iterator_type;
16423
16424 for_each(iterator_type(&m_data, other.begin()), size_type());
16425 }
16426
16427 template<typename other_rep_>
16428 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
16429 {
16430 typedef b_iterator<
16431 iterator,
16432 typename array<signature, traits_type_, other_rep_>::iterator,
16433 swapper<value_type> >
16434 iterator_type;
16435
16436 for_each(iterator_type(&m_data, other.begin()), size_type());
16437 }
16438
16439 private:
16440 value_type m_data;
16441 };
16442
16443
16444
16445 template<
16446 typename value_type_,
16447 int n0_,
16448 typename traits_type_
16449 >
16450 class array<
16451 value_type_[n0_],
16452 traits_type_,
16453 internal_rep<true>
16454 >
16455 {
16456 public:
16457 typedef value_type_ signature[n0_];
16458 typedef traits_type_ traits_type;
16459 typedef value_type_ value_type;
16460 typedef const value_type_& const_reference;
16461 typedef value_type_& reference;
16462
16463 typedef typename array_signature_traits<const signature>::default_rev_iterator const_iterator;
16464 typedef typename array_signature_traits<signature>::default_rev_iterator iterator;
16465 typedef typename array_signature_traits<signature>::size_type size_type;
16466
16467 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
16468 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
16469 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
16470
16471 static const bool is_reverse = true;
16472 static const int dimensions = 1;
16473
16474 LITE_INLINE array()
16475 {}
16476
16477 explicit LITE_INLINE array(int)
16478 {}
16479
16480 explicit LITE_INLINE array(const size_type&)
16481 {}
16482
16483 LITE_INLINE array(const array& other)
16484 {
16485 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
16486
16487 for_each(iterator_type(
16488 &m_data[0],
16489 &other.m_data[0]),
16490 size_type());
16491 }
16492
16493 template<typename other_rep_>
16494 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
16495 {
16496 typedef b_iterator<
16497 iterator,
16498 typename array<signature, traits_type_, other_rep_>::const_iterator,
16499 assign<value_type> >
16500 iterator_type;
16501
16502 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
16503
16504 for_each(iterator_type(&m_data[0], other.begin()), size_type());
16505 }
16506
16507 LITE_INLINE array(const value_type& value)
16508 {
16509 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
16510
16511 for_each(iterator_type(&m_data[0], value), size_type());
16512 }
16513
16514
16515 LITE_INLINE array(
16516 typename detail::type_if<n0_==2, const value_type&, detail::invalid_argument>::type a0,
16517 const value_type& a1
16518 )
16519 {
16520 m_data[0] = a0;
16521 m_data[1] = a1;
16522 }
16523
16524 LITE_INLINE array(
16525 typename detail::type_if<n0_==3, const value_type&, detail::invalid_argument>::type a0,
16526 const value_type& a1,
16527 const value_type& a2
16528 )
16529 {
16530 m_data[0] = a0;
16531 m_data[1] = a1;
16532 m_data[2] = a2;
16533 }
16534
16535 LITE_INLINE array(
16536 typename detail::type_if<n0_==4, const value_type&, detail::invalid_argument>::type a0,
16537 const value_type& a1,
16538 const value_type& a2,
16539 const value_type& a3
16540 )
16541 {
16542 m_data[0] = a0;
16543 m_data[1] = a1;
16544 m_data[2] = a2;
16545 m_data[3] = a3;
16546 }
16547
16548 LITE_INLINE array(
16549 typename detail::type_if<n0_==5, const value_type&, detail::invalid_argument>::type a0,
16550 const value_type& a1,
16551 const value_type& a2,
16552 const value_type& a3,
16553 const value_type& a4
16554 )
16555 {
16556 m_data[0] = a0;
16557 m_data[1] = a1;
16558 m_data[2] = a2;
16559 m_data[3] = a3;
16560 m_data[4] = a4;
16561 }
16562
16563 LITE_INLINE array& operator=(const array& other)
16564 {
16565 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
16566
16567 for_each(iterator_type(
16568 &m_data[0],
16569 &other.m_data[0]),
16570 size_type());
16571 return *this;
16572 }
16573
16574 template<typename other_rep_>
16575 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
16576 {
16577 typedef b_iterator<
16578 iterator,
16579 typename array<signature, traits_type_, other_rep_>::const_iterator,
16580 assign<value_type> >
16581 iterator_type;
16582
16583 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
16584
16585 for_each(iterator_type(&m_data[0], other.begin()), size_type());
16586 return *this;
16587 }
16588
16589 LITE_INLINE array& operator=(const value_type& value)
16590 {
16591 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
16592
16593 for_each(iterator_type(&m_data[0], value), size_type());
16594 return *this;
16595 }
16596
16597 LITE_INLINE const_iterator begin() const
16598 {
16599 return const_iterator(&m_data[0]);
16600 }
16601
16602 LITE_INLINE iterator begin()
16603 {
16604 return iterator(&m_data[0]);
16605 }
16606
16607 LITE_INLINE size_type size() const
16608 {
16609 return size_type();
16610 }
16611
16612 LITE_INLINE const_reference
16613 operator()(int i0) const
16614 {
16615 return m_data[i0];
16616 }
16617
16618 LITE_INLINE reference
16619 operator()(int i0)
16620 {
16621 return m_data[i0];
16622 }
16623
16624 LITE_INLINE const_reference
16625 operator[](int i0) const
16626 {
16627 return m_data[i0];
16628 }
16629
16630 LITE_INLINE reference
16631 operator[](int i0)
16632 {
16633 return m_data[i0];
16634 }
16635
16636
16637 template<typename transform_type_>
16638 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
16639 operator[](const transform_type_& trans) const
16640 {
16641 typedef typename transform_traits<array, transform_type_>::const_array result_type;
16642
16643 return result_type(begin(), size(), trans);
16644 }
16645
16646 template<typename transform_type_>
16647 LITE_INLINE const typename transform_traits<array, transform_type_>::array
16648 operator[](const transform_type_& trans)
16649 {
16650 typedef typename transform_traits<array, transform_type_>::array result_type;
16651
16652 return result_type(begin(), size(), trans);
16653 }
16654
16655 LITE_INLINE const value_type* data() const
16656 {
16657 return &m_data[0];
16658 }
16659
16660 LITE_INLINE value_type* data()
16661 {
16662 return &m_data[0];
16663 }
16664
16665 LITE_INLINE void release()
16666 {}
16667
16668 LITE_INLINE void resize(int)
16669 {}
16670
16671 LITE_INLINE void resize(const size_type&)
16672 {}
16673
16674 template<typename other_rep_>
16675 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
16676 {
16677 typedef b_iterator<
16678 iterator,
16679 typename array<signature, traits_type_, other_rep_>::const_iterator,
16680 swapper<value_type> >
16681 iterator_type;
16682
16683 for_each(iterator_type(&m_data[0], other.begin()), size_type());
16684 }
16685
16686 template<typename other_rep_>
16687 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
16688 {
16689 typedef b_iterator<
16690 iterator,
16691 typename array<signature, traits_type_, other_rep_>::iterator,
16692 swapper<value_type> >
16693 iterator_type;
16694
16695 for_each(iterator_type(&m_data[0], other.begin()), size_type());
16696 }
16697
16698 private:
16699 value_type m_data[n0_];
16700 };
16701
16702
16703
16704 template<
16705 typename value_type_,
16706 int n0_,
16707 int n1_,
16708 typename traits_type_
16709 >
16710 class array<
16711 value_type_[n0_][n1_],
16712 traits_type_,
16713 internal_rep<true>
16714 >
16715 {
16716 public:
16717 typedef value_type_ signature[n0_][n1_];
16718 typedef traits_type_ traits_type;
16719 typedef value_type_ value_type;
16720 typedef const value_type_& const_reference;
16721 typedef value_type_& reference;
16722
16723 typedef typename array_signature_traits<const signature>::default_rev_iterator const_iterator;
16724 typedef typename array_signature_traits<signature>::default_rev_iterator iterator;
16725 typedef typename array_signature_traits<signature>::size_type size_type;
16726
16727 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
16728 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
16729 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
16730
16731 static const bool is_reverse = true;
16732 static const int dimensions = 2;
16733
16734 LITE_INLINE array()
16735 {}
16736
16737 explicit LITE_INLINE array(int, int)
16738 {}
16739
16740 explicit LITE_INLINE array(const size_type&)
16741 {}
16742
16743 LITE_INLINE array(const array& other)
16744 {
16745 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
16746
16747 for_each(iterator_type(
16748 &m_data[0][0],
16749 &other.m_data[0][0]),
16750 size_type());
16751 }
16752
16753 template<typename other_rep_>
16754 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
16755 {
16756 typedef b_iterator<
16757 iterator,
16758 typename array<signature, traits_type_, other_rep_>::const_iterator,
16759 assign<value_type> >
16760 iterator_type;
16761
16762 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
16763
16764 for_each(iterator_type(&m_data[0][0], other.begin()), size_type());
16765 }
16766
16767 LITE_INLINE array(const value_type& value)
16768 {
16769 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
16770
16771 for_each(iterator_type(&m_data[0][0], value), size_type());
16772 }
16773
16774
16775 LITE_INLINE array& operator=(const array& other)
16776 {
16777 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
16778
16779 for_each(iterator_type(
16780 &m_data[0][0],
16781 &other.m_data[0][0]),
16782 size_type());
16783 return *this;
16784 }
16785
16786 template<typename other_rep_>
16787 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
16788 {
16789 typedef b_iterator<
16790 iterator,
16791 typename array<signature, traits_type_, other_rep_>::const_iterator,
16792 assign<value_type> >
16793 iterator_type;
16794
16795 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
16796
16797 for_each(iterator_type(&m_data[0][0], other.begin()), size_type());
16798 return *this;
16799 }
16800
16801 LITE_INLINE array& operator=(const value_type& value)
16802 {
16803 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
16804
16805 for_each(iterator_type(&m_data[0][0], value), size_type());
16806 return *this;
16807 }
16808
16809 LITE_INLINE const_iterator begin() const
16810 {
16811 return const_iterator(&m_data[0][0]);
16812 }
16813
16814 LITE_INLINE iterator begin()
16815 {
16816 return iterator(&m_data[0][0]);
16817 }
16818
16819 LITE_INLINE size_type size() const
16820 {
16821 return size_type();
16822 }
16823
16824 LITE_INLINE const_reference
16825 operator()(int i0, int i1) const
16826 {
16827 return m_data[i1][i0];
16828 }
16829
16830 LITE_INLINE reference
16831 operator()(int i0, int i1)
16832 {
16833 return m_data[i1][i0];
16834 }
16835
16836
16837 template<typename transform_type_>
16838 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
16839 operator[](const transform_type_& trans) const
16840 {
16841 typedef typename transform_traits<array, transform_type_>::const_array result_type;
16842
16843 return result_type(begin(), size(), trans);
16844 }
16845
16846 template<typename transform_type_>
16847 LITE_INLINE const typename transform_traits<array, transform_type_>::array
16848 operator[](const transform_type_& trans)
16849 {
16850 typedef typename transform_traits<array, transform_type_>::array result_type;
16851
16852 return result_type(begin(), size(), trans);
16853 }
16854
16855 LITE_INLINE const value_type* data() const
16856 {
16857 return &m_data[0][0];
16858 }
16859
16860 LITE_INLINE value_type* data()
16861 {
16862 return &m_data[0][0];
16863 }
16864
16865 LITE_INLINE void release()
16866 {}
16867
16868 LITE_INLINE void resize(int, int)
16869 {}
16870
16871 LITE_INLINE void resize(const size_type&)
16872 {}
16873
16874 template<typename other_rep_>
16875 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
16876 {
16877 typedef b_iterator<
16878 iterator,
16879 typename array<signature, traits_type_, other_rep_>::const_iterator,
16880 swapper<value_type> >
16881 iterator_type;
16882
16883 for_each(iterator_type(&m_data[0][0], other.begin()), size_type());
16884 }
16885
16886 template<typename other_rep_>
16887 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
16888 {
16889 typedef b_iterator<
16890 iterator,
16891 typename array<signature, traits_type_, other_rep_>::iterator,
16892 swapper<value_type> >
16893 iterator_type;
16894
16895 for_each(iterator_type(&m_data[0][0], other.begin()), size_type());
16896 }
16897
16898 private:
16899 value_type m_data[n1_][n0_];
16900 };
16901
16902
16903
16904 template<
16905 typename value_type_,
16906 int n0_,
16907 int n1_,
16908 int n2_,
16909 typename traits_type_
16910 >
16911 class array<
16912 value_type_[n0_][n1_][n2_],
16913 traits_type_,
16914 internal_rep<true>
16915 >
16916 {
16917 public:
16918 typedef value_type_ signature[n0_][n1_][n2_];
16919 typedef traits_type_ traits_type;
16920 typedef value_type_ value_type;
16921 typedef const value_type_& const_reference;
16922 typedef value_type_& reference;
16923
16924 typedef typename array_signature_traits<const signature>::default_rev_iterator const_iterator;
16925 typedef typename array_signature_traits<signature>::default_rev_iterator iterator;
16926 typedef typename array_signature_traits<signature>::size_type size_type;
16927
16928 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
16929 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
16930 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
16931
16932 static const bool is_reverse = true;
16933 static const int dimensions = 3;
16934
16935 LITE_INLINE array()
16936 {}
16937
16938 explicit LITE_INLINE array(int, int, int)
16939 {}
16940
16941 explicit LITE_INLINE array(const size_type&)
16942 {}
16943
16944 LITE_INLINE array(const array& other)
16945 {
16946 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
16947
16948 for_each(iterator_type(
16949 &m_data[0][0][0],
16950 &other.m_data[0][0][0]),
16951 size_type());
16952 }
16953
16954 template<typename other_rep_>
16955 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
16956 {
16957 typedef b_iterator<
16958 iterator,
16959 typename array<signature, traits_type_, other_rep_>::const_iterator,
16960 assign<value_type> >
16961 iterator_type;
16962
16963 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
16964
16965 for_each(iterator_type(&m_data[0][0][0], other.begin()), size_type());
16966 }
16967
16968 LITE_INLINE array(const value_type& value)
16969 {
16970 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
16971
16972 for_each(iterator_type(&m_data[0][0][0], value), size_type());
16973 }
16974
16975
16976 LITE_INLINE array& operator=(const array& other)
16977 {
16978 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
16979
16980 for_each(iterator_type(
16981 &m_data[0][0][0],
16982 &other.m_data[0][0][0]),
16983 size_type());
16984 return *this;
16985 }
16986
16987 template<typename other_rep_>
16988 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
16989 {
16990 typedef b_iterator<
16991 iterator,
16992 typename array<signature, traits_type_, other_rep_>::const_iterator,
16993 assign<value_type> >
16994 iterator_type;
16995
16996 LITE_ARRAY_SIZE_CHECK(size_type(), other.size(), "array(): array sizes do not match");
16997
16998 for_each(iterator_type(&m_data[0][0][0], other.begin()), size_type());
16999 return *this;
17000 }
17001
17002 LITE_INLINE array& operator=(const value_type& value)
17003 {
17004 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
17005
17006 for_each(iterator_type(&m_data[0][0][0], value), size_type());
17007 return *this;
17008 }
17009
17010 LITE_INLINE const_iterator begin() const
17011 {
17012 return const_iterator(&m_data[0][0][0]);
17013 }
17014
17015 LITE_INLINE iterator begin()
17016 {
17017 return iterator(&m_data[0][0][0]);
17018 }
17019
17020 LITE_INLINE size_type size() const
17021 {
17022 return size_type();
17023 }
17024
17025 LITE_INLINE const_reference
17026 operator()(int i0, int i1, int i2) const
17027 {
17028 return m_data[i2][i1][i0];
17029 }
17030
17031 LITE_INLINE reference
17032 operator()(int i0, int i1, int i2)
17033 {
17034 return m_data[i2][i1][i0];
17035 }
17036
17037
17038 template<typename transform_type_>
17039 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
17040 operator[](const transform_type_& trans) const
17041 {
17042 typedef typename transform_traits<array, transform_type_>::const_array result_type;
17043
17044 return result_type(begin(), size(), trans);
17045 }
17046
17047 template<typename transform_type_>
17048 LITE_INLINE const typename transform_traits<array, transform_type_>::array
17049 operator[](const transform_type_& trans)
17050 {
17051 typedef typename transform_traits<array, transform_type_>::array result_type;
17052
17053 return result_type(begin(), size(), trans);
17054 }
17055
17056 LITE_INLINE const value_type* data() const
17057 {
17058 return &m_data[0][0][0];
17059 }
17060
17061 LITE_INLINE value_type* data()
17062 {
17063 return &m_data[0][0][0];
17064 }
17065
17066 LITE_INLINE void release()
17067 {}
17068
17069 LITE_INLINE void resize(int, int, int)
17070 {}
17071
17072 LITE_INLINE void resize(const size_type&)
17073 {}
17074
17075 template<typename other_rep_>
17076 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
17077 {
17078 typedef b_iterator<
17079 iterator,
17080 typename array<signature, traits_type_, other_rep_>::const_iterator,
17081 swapper<value_type> >
17082 iterator_type;
17083
17084 for_each(iterator_type(&m_data[0][0][0], other.begin()), size_type());
17085 }
17086
17087 template<typename other_rep_>
17088 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
17089 {
17090 typedef b_iterator<
17091 iterator,
17092 typename array<signature, traits_type_, other_rep_>::iterator,
17093 swapper<value_type> >
17094 iterator_type;
17095
17096 for_each(iterator_type(&m_data[0][0][0], other.begin()), size_type());
17097 }
17098
17099 private:
17100 value_type m_data[n2_][n1_][n0_];
17101 };
17102
17103
17104
17105
17106
17107
17108
17109
17117 template<bool reversed_, int internal_buf_size_>
17118 class hybrid_rep
17119 {};
17120
17121
17122 template<
17123 typename value_type_,
17124 typename traits_type_,
17125 int internal_buf_size_
17126 >
17127 class array<
17128 value_type_,
17129 traits_type_,
17130 hybrid_rep<false, internal_buf_size_>
17131 >
17132 {
17133 public:
17134 typedef value_type_ signature;
17135 typedef traits_type_ traits_type;
17136 typedef value_type_ value_type;
17137 typedef const value_type_& const_reference;
17138 typedef value_type_& reference;
17139
17140 typedef typename array_signature_traits<const signature>::default_iterator const_iterator;
17141 typedef typename array_signature_traits<signature>::default_iterator iterator;
17142 typedef typename array_signature_traits<signature>::size_type size_type;
17143
17144 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
17145 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
17146 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
17147
17148 static const int dimensions = 0;
17149 static const bool is_reverse = false;
17150 static const int internal_buffer_size = internal_buf_size_;
17151
17152
17153
17154 explicit LITE_INLINE array(const size_type& sz)
17155 {
17156 init();
17157 resize(sz);
17158 }
17159
17160 LITE_INLINE array(const array& other)
17161 {
17162 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
17163
17164 init();
17165 resize(other.size());
17166 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
17167 }
17168
17169 template<typename other_rep_>
17170 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
17171 {
17172 typedef b_iterator<
17173 iterator,
17174 typename array<signature, traits_type_, other_rep_>::const_iterator,
17175 assign<value_type> >
17176 iterator_type;
17177
17178 init();
17179 resize(other.size());
17180 for_each(iterator_type(m_iterator, other.begin()), m_size);
17181 }
17182
17183 LITE_INLINE array(const value_type& value)
17184 {
17185 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
17186
17187 init();
17188 for_each(iterator_type(m_iterator, value), m_size);
17189 }
17190
17191 LITE_INLINE array& operator=(const array& other)
17192 {
17193 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
17194
17195 resize(other.size());
17196 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
17197 return *this;
17198 }
17199
17200 template<typename other_rep_>
17201 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
17202 {
17203 typedef b_iterator<
17204 iterator,
17205 typename array<signature, traits_type_, other_rep_>::const_iterator,
17206 assign<value_type> >
17207 iterator_type;
17208
17209 resize(other.size());
17210 for_each(iterator_type(m_iterator, other.begin()), m_size);
17211 return *this;
17212 }
17213
17214 LITE_INLINE array& operator=(const value_type& value)
17215 {
17216 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
17217
17218 for_each(iterator_type(m_iterator, value), m_size);
17219 return *this;
17220 }
17221
17222 LITE_INLINE const_iterator begin() const
17223 {
17224 return m_iterator;
17225 }
17226
17227 LITE_INLINE iterator begin()
17228 {
17229 return m_iterator;
17230 }
17231
17232 LITE_INLINE size_type size() const
17233 {
17234 return m_size;
17235 }
17236
17237 LITE_INLINE const_reference
17238 operator()() const
17239 {
17240 return *(m_iterator.i0);
17241 }
17242
17243 LITE_INLINE reference
17244 operator()()
17245 {
17246 return *(m_iterator.i0);
17247 }
17248
17249
17250 template<typename transform_type_>
17251 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
17252 operator[](const transform_type_& trans) const
17253 {
17254 typedef typename transform_traits<array, transform_type_>::const_array result_type;
17255
17256 return result_type(begin(), size(), trans);
17257 }
17258
17259 template<typename transform_type_>
17260 LITE_INLINE const typename transform_traits<array, transform_type_>::array
17261 operator[](const transform_type_& trans)
17262 {
17263 typedef typename transform_traits<array, transform_type_>::array result_type;
17264
17265 return result_type(begin(), size(), trans);
17266 }
17267
17268 LITE_INLINE const value_type* data() const
17269 {
17270 return m_iterator.i0;
17271 }
17272
17273 LITE_INLINE value_type* data()
17274 {
17275 return m_iterator.i0;
17276 }
17277
17278 LITE_INLINE void release()
17279 {
17280 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
17281 delete[] m_iterator.i0;
17282
17283 m_iterator.i0 = 0;
17284 m_size.set();
17285 }
17286
17287 LITE_INLINE void resize()
17288 {
17289 resize(size_type());
17290 }
17291
17292 LITE_INLINE void resize(const size_type& new_size)
17293 {
17294 int old_volumne = volume(m_size);
17295 int new_volume = volume(new_size);
17296
17297 if (old_volumne != new_volume || m_iterator.i0==0) {
17298 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
17299 delete[] m_iterator.i0;
17300 m_iterator.i0 = 0;
17301 m_size.set();
17302
17303 if (new_volume == 0)
17304 return;
17305
17306 m_iterator.i0 = new_volume <= internal_buffer_size ? m_buffer : new value_type[new_volume];
17307 }
17308 m_size = new_size;
17309 m_iterator.set(
17310 m_iterator.i0
17311 );
17312 }
17313
17314 template<typename other_rep_>
17315 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
17316 {
17317 regular_swap(other);
17318 }
17319
17320 template<typename other_rep_>
17321 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
17322 {
17323 regular_swap(other);
17324 }
17325
17326 LITE_INLINE void swap(array& other)
17327 {
17328
17329 if (m_iterator.i0 != m_buffer && other.m_iterator.i0 != other.m_buffer) {
17330 iterator tmp_iter = other.m_iterator;
17331 size_type tmp_size = other.m_size;
17332
17333 other.m_iterator = m_iterator;
17334 other.m_size = m_size;
17335
17336 m_iterator = tmp_iter;
17337 m_size = tmp_size;
17338 }
17339 else
17340 regular_swap(other);
17341 }
17342
17343
17344 LITE_INLINE ~array()
17345 {
17346 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
17347 delete[] m_iterator.i0;
17348 }
17349
17350 private:
17351
17352 template<typename other_array_>
17353 LITE_INLINE void regular_swap(other_array_& other)
17354 {
17355 typedef b_iterator<iterator, typename other_array_::iterator, swapper<value_type> > iterator_type;
17356
17357 if (m_size == other.size())
17358 for_each(iterator_type(m_iterator, other.begin()), m_size);
17359 else {
17360 typename other_array_::temporary_array tmp = other;
17361
17362 other = *this;
17363 *this = tmp;
17364 }
17365 }
17366
17367
17368
17369
17370 LITE_INLINE void init()
17371 {
17372 m_iterator.i0 = 0;
17373 m_size.set();
17374 resize(m_size);
17375 }
17376
17377 iterator m_iterator;
17378 size_type m_size;
17379 value_type m_buffer[internal_buffer_size >= 1 ? internal_buffer_size : 1];
17380 };
17381
17382
17383
17384 template<
17385 typename value_type_,
17386 int n0_,
17387 typename traits_type_,
17388 int internal_buf_size_
17389 >
17390 class array<
17391 value_type_[n0_],
17392 traits_type_,
17393 hybrid_rep<false, internal_buf_size_>
17394 >
17395 {
17396 public:
17397 typedef value_type_ signature[n0_];
17398 typedef traits_type_ traits_type;
17399 typedef value_type_ value_type;
17400 typedef const value_type_& const_reference;
17401 typedef value_type_& reference;
17402
17403 typedef typename array_signature_traits<const signature>::default_iterator const_iterator;
17404 typedef typename array_signature_traits<signature>::default_iterator iterator;
17405 typedef typename array_signature_traits<signature>::size_type size_type;
17406
17407 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
17408 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
17409 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
17410
17411 static const int dimensions = 1;
17412 static const bool is_reverse = false;
17413 static const int internal_buffer_size = internal_buf_size_;
17414
17415 LITE_INLINE array()
17416 {
17417 init();
17418 resize(size_type());
17419 }
17420
17421 explicit LITE_INLINE array(int n0)
17422 {
17423 init();
17424 resize(size_type(n0));
17425 }
17426
17427 explicit LITE_INLINE array(const size_type& sz)
17428 {
17429 init();
17430 resize(sz);
17431 }
17432
17433 LITE_INLINE array(const array& other)
17434 {
17435 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
17436
17437 init();
17438 resize(other.size());
17439 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
17440 }
17441
17442 template<typename other_rep_>
17443 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
17444 {
17445 typedef b_iterator<
17446 iterator,
17447 typename array<signature, traits_type_, other_rep_>::const_iterator,
17448 assign<value_type> >
17449 iterator_type;
17450
17451 init();
17452 resize(other.size());
17453 for_each(iterator_type(m_iterator, other.begin()), m_size);
17454 }
17455
17456 LITE_INLINE array(const value_type& value)
17457 {
17458 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
17459
17460 init();
17461 for_each(iterator_type(m_iterator, value), m_size);
17462 }
17463
17464 LITE_INLINE array& operator=(const array& other)
17465 {
17466 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
17467
17468 resize(other.size());
17469 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
17470 return *this;
17471 }
17472
17473 template<typename other_rep_>
17474 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
17475 {
17476 typedef b_iterator<
17477 iterator,
17478 typename array<signature, traits_type_, other_rep_>::const_iterator,
17479 assign<value_type> >
17480 iterator_type;
17481
17482 resize(other.size());
17483 for_each(iterator_type(m_iterator, other.begin()), m_size);
17484 return *this;
17485 }
17486
17487 LITE_INLINE array& operator=(const value_type& value)
17488 {
17489 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
17490
17491 for_each(iterator_type(m_iterator, value), m_size);
17492 return *this;
17493 }
17494
17495 LITE_INLINE const_iterator begin() const
17496 {
17497 return m_iterator;
17498 }
17499
17500 LITE_INLINE iterator begin()
17501 {
17502 return m_iterator;
17503 }
17504
17505 LITE_INLINE size_type size() const
17506 {
17507 return m_size;
17508 }
17509
17510 LITE_INLINE const_reference
17511 operator()(int i0) const
17512 {
17513 return *(m_iterator.i0+i0*m_iterator.i1);
17514 }
17515
17516 LITE_INLINE reference
17517 operator()(int i0)
17518 {
17519 return *(m_iterator.i0+i0*m_iterator.i1);
17520 }
17521
17522 LITE_INLINE const_reference
17523 operator[](int i0) const
17524 {
17525 return *(m_iterator.i0+i0*m_iterator.i1);
17526 }
17527
17528 LITE_INLINE reference
17529 operator[](int i0)
17530 {
17531 return *(m_iterator.i0+i0*m_iterator.i1);
17532 }
17533
17534
17535 template<typename transform_type_>
17536 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
17537 operator[](const transform_type_& trans) const
17538 {
17539 typedef typename transform_traits<array, transform_type_>::const_array result_type;
17540
17541 return result_type(begin(), size(), trans);
17542 }
17543
17544 template<typename transform_type_>
17545 LITE_INLINE const typename transform_traits<array, transform_type_>::array
17546 operator[](const transform_type_& trans)
17547 {
17548 typedef typename transform_traits<array, transform_type_>::array result_type;
17549
17550 return result_type(begin(), size(), trans);
17551 }
17552
17553 LITE_INLINE const value_type* data() const
17554 {
17555 return m_iterator.i0;
17556 }
17557
17558 LITE_INLINE value_type* data()
17559 {
17560 return m_iterator.i0;
17561 }
17562
17563 LITE_INLINE void release()
17564 {
17565 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
17566 delete[] m_iterator.i0;
17567
17568 m_iterator.i0 = 0;
17569 m_size.set(0);
17570 }
17571
17572 LITE_INLINE void resize(int n0)
17573 {
17574 resize(size_type(n0));
17575 }
17576
17577 LITE_INLINE void resize(const size_type& new_size)
17578 {
17579 int old_volumne = volume(m_size);
17580 int new_volume = volume(new_size);
17581
17582 if (old_volumne != new_volume || m_iterator.i0==0) {
17583 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
17584 delete[] m_iterator.i0;
17585 m_iterator.i0 = 0;
17586 m_size.set(0);
17587
17588 if (new_volume == 0)
17589 return;
17590
17591 m_iterator.i0 = new_volume <= internal_buffer_size ? m_buffer : new value_type[new_volume];
17592 }
17593 m_size = new_size;
17594 m_iterator.set(
17595 m_iterator.i0,
17596 1
17597 );
17598 }
17599
17600 template<typename other_rep_>
17601 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
17602 {
17603 regular_swap(other);
17604 }
17605
17606 template<typename other_rep_>
17607 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
17608 {
17609 regular_swap(other);
17610 }
17611
17612 LITE_INLINE void swap(array& other)
17613 {
17614
17615 if (m_iterator.i0 != m_buffer && other.m_iterator.i0 != other.m_buffer) {
17616 iterator tmp_iter = other.m_iterator;
17617 size_type tmp_size = other.m_size;
17618
17619 other.m_iterator = m_iterator;
17620 other.m_size = m_size;
17621
17622 m_iterator = tmp_iter;
17623 m_size = tmp_size;
17624 }
17625 else
17626 regular_swap(other);
17627 }
17628
17629
17630 LITE_INLINE ~array()
17631 {
17632 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
17633 delete[] m_iterator.i0;
17634 }
17635
17636 private:
17637
17638 template<typename other_array_>
17639 LITE_INLINE void regular_swap(other_array_& other)
17640 {
17641 typedef b_iterator<iterator, typename other_array_::iterator, swapper<value_type> > iterator_type;
17642
17643 if (m_size == other.size())
17644 for_each(iterator_type(m_iterator, other.begin()), m_size);
17645 else {
17646 typename other_array_::temporary_array tmp = other;
17647
17648 other = *this;
17649 *this = tmp;
17650 }
17651 }
17652
17653
17654
17655
17656 LITE_INLINE void init()
17657 {
17658 m_iterator.i0 = 0;
17659 m_size.set(0);
17660 resize(m_size);
17661 }
17662
17663 iterator m_iterator;
17664 size_type m_size;
17665 value_type m_buffer[internal_buffer_size >= 1 ? internal_buffer_size : 1];
17666 };
17667
17668
17669
17670 template<
17671 typename value_type_,
17672 int n0_,
17673 int n1_,
17674 typename traits_type_,
17675 int internal_buf_size_
17676 >
17677 class array<
17678 value_type_[n0_][n1_],
17679 traits_type_,
17680 hybrid_rep<false, internal_buf_size_>
17681 >
17682 {
17683 public:
17684 typedef value_type_ signature[n0_][n1_];
17685 typedef traits_type_ traits_type;
17686 typedef value_type_ value_type;
17687 typedef const value_type_& const_reference;
17688 typedef value_type_& reference;
17689
17690 typedef typename array_signature_traits<const signature>::default_iterator const_iterator;
17691 typedef typename array_signature_traits<signature>::default_iterator iterator;
17692 typedef typename array_signature_traits<signature>::size_type size_type;
17693
17694 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
17695 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
17696 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
17697
17698 static const int dimensions = 2;
17699 static const bool is_reverse = false;
17700 static const int internal_buffer_size = internal_buf_size_;
17701
17702 LITE_INLINE array()
17703 {
17704 init();
17705 resize(size_type());
17706 }
17707
17708 explicit LITE_INLINE array(int n0, int n1)
17709 {
17710 init();
17711 resize(size_type(n0, n1));
17712 }
17713
17714 explicit LITE_INLINE array(const size_type& sz)
17715 {
17716 init();
17717 resize(sz);
17718 }
17719
17720 LITE_INLINE array(const array& other)
17721 {
17722 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
17723
17724 init();
17725 resize(other.size());
17726 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
17727 }
17728
17729 template<typename other_rep_>
17730 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
17731 {
17732 typedef b_iterator<
17733 iterator,
17734 typename array<signature, traits_type_, other_rep_>::const_iterator,
17735 assign<value_type> >
17736 iterator_type;
17737
17738 init();
17739 resize(other.size());
17740 for_each(iterator_type(m_iterator, other.begin()), m_size);
17741 }
17742
17743 LITE_INLINE array(const value_type& value)
17744 {
17745 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
17746
17747 init();
17748 for_each(iterator_type(m_iterator, value), m_size);
17749 }
17750
17751 LITE_INLINE array& operator=(const array& other)
17752 {
17753 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
17754
17755 resize(other.size());
17756 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
17757 return *this;
17758 }
17759
17760 template<typename other_rep_>
17761 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
17762 {
17763 typedef b_iterator<
17764 iterator,
17765 typename array<signature, traits_type_, other_rep_>::const_iterator,
17766 assign<value_type> >
17767 iterator_type;
17768
17769 resize(other.size());
17770 for_each(iterator_type(m_iterator, other.begin()), m_size);
17771 return *this;
17772 }
17773
17774 LITE_INLINE array& operator=(const value_type& value)
17775 {
17776 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
17777
17778 for_each(iterator_type(m_iterator, value), m_size);
17779 return *this;
17780 }
17781
17782 LITE_INLINE const_iterator begin() const
17783 {
17784 return m_iterator;
17785 }
17786
17787 LITE_INLINE iterator begin()
17788 {
17789 return m_iterator;
17790 }
17791
17792 LITE_INLINE size_type size() const
17793 {
17794 return m_size;
17795 }
17796
17797 LITE_INLINE const_reference
17798 operator()(int i0, int i1) const
17799 {
17800 return *(m_iterator.i0+i0*m_iterator.i1+i1*m_iterator.i2);
17801 }
17802
17803 LITE_INLINE reference
17804 operator()(int i0, int i1)
17805 {
17806 return *(m_iterator.i0+i0*m_iterator.i1+i1*m_iterator.i2);
17807 }
17808
17809
17810 template<typename transform_type_>
17811 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
17812 operator[](const transform_type_& trans) const
17813 {
17814 typedef typename transform_traits<array, transform_type_>::const_array result_type;
17815
17816 return result_type(begin(), size(), trans);
17817 }
17818
17819 template<typename transform_type_>
17820 LITE_INLINE const typename transform_traits<array, transform_type_>::array
17821 operator[](const transform_type_& trans)
17822 {
17823 typedef typename transform_traits<array, transform_type_>::array result_type;
17824
17825 return result_type(begin(), size(), trans);
17826 }
17827
17828 LITE_INLINE const value_type* data() const
17829 {
17830 return m_iterator.i0;
17831 }
17832
17833 LITE_INLINE value_type* data()
17834 {
17835 return m_iterator.i0;
17836 }
17837
17838 LITE_INLINE void release()
17839 {
17840 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
17841 delete[] m_iterator.i0;
17842
17843 m_iterator.i0 = 0;
17844 m_size.set(0, 0);
17845 }
17846
17847 LITE_INLINE void resize(int n0, int n1)
17848 {
17849 resize(size_type(n0, n1));
17850 }
17851
17852 LITE_INLINE void resize(const size_type& new_size)
17853 {
17854 int old_volumne = volume(m_size);
17855 int new_volume = volume(new_size);
17856
17857 if (old_volumne != new_volume || m_iterator.i0==0) {
17858 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
17859 delete[] m_iterator.i0;
17860 m_iterator.i0 = 0;
17861 m_size.set(0, 0);
17862
17863 if (new_volume == 0)
17864 return;
17865
17866 m_iterator.i0 = new_volume <= internal_buffer_size ? m_buffer : new value_type[new_volume];
17867 }
17868 m_size = new_size;
17869 m_iterator.set(
17870 m_iterator.i0,
17871 m_size.i1,
17872 1
17873 );
17874 }
17875
17876 template<typename other_rep_>
17877 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
17878 {
17879 regular_swap(other);
17880 }
17881
17882 template<typename other_rep_>
17883 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
17884 {
17885 regular_swap(other);
17886 }
17887
17888 LITE_INLINE void swap(array& other)
17889 {
17890
17891 if (m_iterator.i0 != m_buffer && other.m_iterator.i0 != other.m_buffer) {
17892 iterator tmp_iter = other.m_iterator;
17893 size_type tmp_size = other.m_size;
17894
17895 other.m_iterator = m_iterator;
17896 other.m_size = m_size;
17897
17898 m_iterator = tmp_iter;
17899 m_size = tmp_size;
17900 }
17901 else
17902 regular_swap(other);
17903 }
17904
17905
17906 LITE_INLINE ~array()
17907 {
17908 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
17909 delete[] m_iterator.i0;
17910 }
17911
17912 private:
17913
17914 template<typename other_array_>
17915 LITE_INLINE void regular_swap(other_array_& other)
17916 {
17917 typedef b_iterator<iterator, typename other_array_::iterator, swapper<value_type> > iterator_type;
17918
17919 if (m_size == other.size())
17920 for_each(iterator_type(m_iterator, other.begin()), m_size);
17921 else {
17922 typename other_array_::temporary_array tmp = other;
17923
17924 other = *this;
17925 *this = tmp;
17926 }
17927 }
17928
17929
17930
17931
17932 LITE_INLINE void init()
17933 {
17934 m_iterator.i0 = 0;
17935 m_size.set(0, 0);
17936 resize(m_size);
17937 }
17938
17939 iterator m_iterator;
17940 size_type m_size;
17941 value_type m_buffer[internal_buffer_size >= 1 ? internal_buffer_size : 1];
17942 };
17943
17944
17945
17946 template<
17947 typename value_type_,
17948 int n0_,
17949 int n1_,
17950 int n2_,
17951 typename traits_type_,
17952 int internal_buf_size_
17953 >
17954 class array<
17955 value_type_[n0_][n1_][n2_],
17956 traits_type_,
17957 hybrid_rep<false, internal_buf_size_>
17958 >
17959 {
17960 public:
17961 typedef value_type_ signature[n0_][n1_][n2_];
17962 typedef traits_type_ traits_type;
17963 typedef value_type_ value_type;
17964 typedef const value_type_& const_reference;
17965 typedef value_type_& reference;
17966
17967 typedef typename array_signature_traits<const signature>::default_iterator const_iterator;
17968 typedef typename array_signature_traits<signature>::default_iterator iterator;
17969 typedef typename array_signature_traits<signature>::size_type size_type;
17970
17971 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
17972 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
17973 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
17974
17975 static const int dimensions = 3;
17976 static const bool is_reverse = false;
17977 static const int internal_buffer_size = internal_buf_size_;
17978
17979 LITE_INLINE array()
17980 {
17981 init();
17982 resize(size_type());
17983 }
17984
17985 explicit LITE_INLINE array(int n0, int n1, int n2)
17986 {
17987 init();
17988 resize(size_type(n0, n1, n2));
17989 }
17990
17991 explicit LITE_INLINE array(const size_type& sz)
17992 {
17993 init();
17994 resize(sz);
17995 }
17996
17997 LITE_INLINE array(const array& other)
17998 {
17999 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
18000
18001 init();
18002 resize(other.size());
18003 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
18004 }
18005
18006 template<typename other_rep_>
18007 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
18008 {
18009 typedef b_iterator<
18010 iterator,
18011 typename array<signature, traits_type_, other_rep_>::const_iterator,
18012 assign<value_type> >
18013 iterator_type;
18014
18015 init();
18016 resize(other.size());
18017 for_each(iterator_type(m_iterator, other.begin()), m_size);
18018 }
18019
18020 LITE_INLINE array(const value_type& value)
18021 {
18022 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
18023
18024 init();
18025 for_each(iterator_type(m_iterator, value), m_size);
18026 }
18027
18028 LITE_INLINE array& operator=(const array& other)
18029 {
18030 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
18031
18032 resize(other.size());
18033 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
18034 return *this;
18035 }
18036
18037 template<typename other_rep_>
18038 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
18039 {
18040 typedef b_iterator<
18041 iterator,
18042 typename array<signature, traits_type_, other_rep_>::const_iterator,
18043 assign<value_type> >
18044 iterator_type;
18045
18046 resize(other.size());
18047 for_each(iterator_type(m_iterator, other.begin()), m_size);
18048 return *this;
18049 }
18050
18051 LITE_INLINE array& operator=(const value_type& value)
18052 {
18053 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
18054
18055 for_each(iterator_type(m_iterator, value), m_size);
18056 return *this;
18057 }
18058
18059 LITE_INLINE const_iterator begin() const
18060 {
18061 return m_iterator;
18062 }
18063
18064 LITE_INLINE iterator begin()
18065 {
18066 return m_iterator;
18067 }
18068
18069 LITE_INLINE size_type size() const
18070 {
18071 return m_size;
18072 }
18073
18074 LITE_INLINE const_reference
18075 operator()(int i0, int i1, int i2) const
18076 {
18077 return *(m_iterator.i0+i0*m_iterator.i1+i1*m_iterator.i2+i2*m_iterator.i3);
18078 }
18079
18080 LITE_INLINE reference
18081 operator()(int i0, int i1, int i2)
18082 {
18083 return *(m_iterator.i0+i0*m_iterator.i1+i1*m_iterator.i2+i2*m_iterator.i3);
18084 }
18085
18086
18087 template<typename transform_type_>
18088 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
18089 operator[](const transform_type_& trans) const
18090 {
18091 typedef typename transform_traits<array, transform_type_>::const_array result_type;
18092
18093 return result_type(begin(), size(), trans);
18094 }
18095
18096 template<typename transform_type_>
18097 LITE_INLINE const typename transform_traits<array, transform_type_>::array
18098 operator[](const transform_type_& trans)
18099 {
18100 typedef typename transform_traits<array, transform_type_>::array result_type;
18101
18102 return result_type(begin(), size(), trans);
18103 }
18104
18105 LITE_INLINE const value_type* data() const
18106 {
18107 return m_iterator.i0;
18108 }
18109
18110 LITE_INLINE value_type* data()
18111 {
18112 return m_iterator.i0;
18113 }
18114
18115 LITE_INLINE void release()
18116 {
18117 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18118 delete[] m_iterator.i0;
18119
18120 m_iterator.i0 = 0;
18121 m_size.set(0, 0, 0);
18122 }
18123
18124 LITE_INLINE void resize(int n0, int n1, int n2)
18125 {
18126 resize(size_type(n0, n1, n2));
18127 }
18128
18129 LITE_INLINE void resize(const size_type& new_size)
18130 {
18131 int old_volumne = volume(m_size);
18132 int new_volume = volume(new_size);
18133
18134 if (old_volumne != new_volume || m_iterator.i0==0) {
18135 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18136 delete[] m_iterator.i0;
18137 m_iterator.i0 = 0;
18138 m_size.set(0, 0, 0);
18139
18140 if (new_volume == 0)
18141 return;
18142
18143 m_iterator.i0 = new_volume <= internal_buffer_size ? m_buffer : new value_type[new_volume];
18144 }
18145 m_size = new_size;
18146 m_iterator.set(
18147 m_iterator.i0,
18148 m_size.i1*m_size.i2,
18149 m_size.i2,
18150 1
18151 );
18152 }
18153
18154 template<typename other_rep_>
18155 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
18156 {
18157 regular_swap(other);
18158 }
18159
18160 template<typename other_rep_>
18161 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
18162 {
18163 regular_swap(other);
18164 }
18165
18166 LITE_INLINE void swap(array& other)
18167 {
18168
18169 if (m_iterator.i0 != m_buffer && other.m_iterator.i0 != other.m_buffer) {
18170 iterator tmp_iter = other.m_iterator;
18171 size_type tmp_size = other.m_size;
18172
18173 other.m_iterator = m_iterator;
18174 other.m_size = m_size;
18175
18176 m_iterator = tmp_iter;
18177 m_size = tmp_size;
18178 }
18179 else
18180 regular_swap(other);
18181 }
18182
18183
18184 LITE_INLINE ~array()
18185 {
18186 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18187 delete[] m_iterator.i0;
18188 }
18189
18190 private:
18191
18192 template<typename other_array_>
18193 LITE_INLINE void regular_swap(other_array_& other)
18194 {
18195 typedef b_iterator<iterator, typename other_array_::iterator, swapper<value_type> > iterator_type;
18196
18197 if (m_size == other.size())
18198 for_each(iterator_type(m_iterator, other.begin()), m_size);
18199 else {
18200 typename other_array_::temporary_array tmp = other;
18201
18202 other = *this;
18203 *this = tmp;
18204 }
18205 }
18206
18207
18208
18209
18210 LITE_INLINE void init()
18211 {
18212 m_iterator.i0 = 0;
18213 m_size.set(0, 0, 0);
18214 resize(m_size);
18215 }
18216
18217 iterator m_iterator;
18218 size_type m_size;
18219 value_type m_buffer[internal_buffer_size >= 1 ? internal_buffer_size : 1];
18220 };
18221
18222
18223
18224 template<
18225 typename value_type_,
18226 typename traits_type_,
18227 int internal_buf_size_
18228 >
18229 class array<
18230 value_type_,
18231 traits_type_,
18232 hybrid_rep<true, internal_buf_size_>
18233 >
18234 {
18235 public:
18236 typedef value_type_ signature;
18237 typedef traits_type_ traits_type;
18238 typedef value_type_ value_type;
18239 typedef const value_type_& const_reference;
18240 typedef value_type_& reference;
18241
18242 typedef typename array_signature_traits<const signature>::default_rev_iterator const_iterator;
18243 typedef typename array_signature_traits<signature>::default_rev_iterator iterator;
18244 typedef typename array_signature_traits<signature>::size_type size_type;
18245
18246 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
18247 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
18248 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
18249
18250 static const int dimensions = 0;
18251 static const bool is_reverse = true;
18252 static const int internal_buffer_size = internal_buf_size_;
18253
18254
18255
18256 explicit LITE_INLINE array(const size_type& sz)
18257 {
18258 init();
18259 resize(sz);
18260 }
18261
18262 LITE_INLINE array(const array& other)
18263 {
18264 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
18265
18266 init();
18267 resize(other.size());
18268 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
18269 }
18270
18271 template<typename other_rep_>
18272 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
18273 {
18274 typedef b_iterator<
18275 iterator,
18276 typename array<signature, traits_type_, other_rep_>::const_iterator,
18277 assign<value_type> >
18278 iterator_type;
18279
18280 init();
18281 resize(other.size());
18282 for_each(iterator_type(m_iterator, other.begin()), m_size);
18283 }
18284
18285 LITE_INLINE array(const value_type& value)
18286 {
18287 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
18288
18289 init();
18290 for_each(iterator_type(m_iterator, value), m_size);
18291 }
18292
18293 LITE_INLINE array& operator=(const array& other)
18294 {
18295 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
18296
18297 resize(other.size());
18298 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
18299 return *this;
18300 }
18301
18302 template<typename other_rep_>
18303 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
18304 {
18305 typedef b_iterator<
18306 iterator,
18307 typename array<signature, traits_type_, other_rep_>::const_iterator,
18308 assign<value_type> >
18309 iterator_type;
18310
18311 resize(other.size());
18312 for_each(iterator_type(m_iterator, other.begin()), m_size);
18313 return *this;
18314 }
18315
18316 LITE_INLINE array& operator=(const value_type& value)
18317 {
18318 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
18319
18320 for_each(iterator_type(m_iterator, value), m_size);
18321 return *this;
18322 }
18323
18324 LITE_INLINE const_iterator begin() const
18325 {
18326 return m_iterator;
18327 }
18328
18329 LITE_INLINE iterator begin()
18330 {
18331 return m_iterator;
18332 }
18333
18334 LITE_INLINE size_type size() const
18335 {
18336 return m_size;
18337 }
18338
18339 LITE_INLINE const_reference
18340 operator()() const
18341 {
18342 return *(m_iterator.i0);
18343 }
18344
18345 LITE_INLINE reference
18346 operator()()
18347 {
18348 return *(m_iterator.i0);
18349 }
18350
18351
18352 template<typename transform_type_>
18353 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
18354 operator[](const transform_type_& trans) const
18355 {
18356 typedef typename transform_traits<array, transform_type_>::const_array result_type;
18357
18358 return result_type(begin(), size(), trans);
18359 }
18360
18361 template<typename transform_type_>
18362 LITE_INLINE const typename transform_traits<array, transform_type_>::array
18363 operator[](const transform_type_& trans)
18364 {
18365 typedef typename transform_traits<array, transform_type_>::array result_type;
18366
18367 return result_type(begin(), size(), trans);
18368 }
18369
18370 LITE_INLINE const value_type* data() const
18371 {
18372 return m_iterator.i0;
18373 }
18374
18375 LITE_INLINE value_type* data()
18376 {
18377 return m_iterator.i0;
18378 }
18379
18380 LITE_INLINE void release()
18381 {
18382 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18383 delete[] m_iterator.i0;
18384
18385 m_iterator.i0 = 0;
18386 m_size.set();
18387 }
18388
18389 LITE_INLINE void resize()
18390 {
18391 resize(size_type());
18392 }
18393
18394 LITE_INLINE void resize(const size_type& new_size)
18395 {
18396 int old_volumne = volume(m_size);
18397 int new_volume = volume(new_size);
18398
18399 if (old_volumne != new_volume || m_iterator.i0==0) {
18400 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18401 delete[] m_iterator.i0;
18402 m_iterator.i0 = 0;
18403 m_size.set();
18404
18405 if (new_volume == 0)
18406 return;
18407
18408 m_iterator.i0 = new_volume <= internal_buffer_size ? m_buffer : new value_type[new_volume];
18409 }
18410 m_size = new_size;
18411 m_iterator.set(
18412 m_iterator.i0
18413 );
18414 }
18415
18416 template<typename other_rep_>
18417 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
18418 {
18419 regular_swap(other);
18420 }
18421
18422 template<typename other_rep_>
18423 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
18424 {
18425 regular_swap(other);
18426 }
18427
18428 LITE_INLINE void swap(array& other)
18429 {
18430
18431 if (m_iterator.i0 != m_buffer && other.m_iterator.i0 != other.m_buffer) {
18432 iterator tmp_iter = other.m_iterator;
18433 size_type tmp_size = other.m_size;
18434
18435 other.m_iterator = m_iterator;
18436 other.m_size = m_size;
18437
18438 m_iterator = tmp_iter;
18439 m_size = tmp_size;
18440 }
18441 else
18442 regular_swap(other);
18443 }
18444
18445
18446 LITE_INLINE ~array()
18447 {
18448 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18449 delete[] m_iterator.i0;
18450 }
18451
18452 private:
18453
18454 template<typename other_array_>
18455 LITE_INLINE void regular_swap(other_array_& other)
18456 {
18457 typedef b_iterator<iterator, typename other_array_::iterator, swapper<value_type> > iterator_type;
18458
18459 if (m_size == other.size())
18460 for_each(iterator_type(m_iterator, other.begin()), m_size);
18461 else {
18462 typename other_array_::temporary_array tmp = other;
18463
18464 other = *this;
18465 *this = tmp;
18466 }
18467 }
18468
18469
18470
18471
18472 LITE_INLINE void init()
18473 {
18474 m_iterator.i0 = 0;
18475 m_size.set();
18476 resize(m_size);
18477 }
18478
18479 iterator m_iterator;
18480 size_type m_size;
18481 value_type m_buffer[internal_buffer_size >= 1 ? internal_buffer_size : 1];
18482 };
18483
18484
18485
18486 template<
18487 typename value_type_,
18488 int n0_,
18489 typename traits_type_,
18490 int internal_buf_size_
18491 >
18492 class array<
18493 value_type_[n0_],
18494 traits_type_,
18495 hybrid_rep<true, internal_buf_size_>
18496 >
18497 {
18498 public:
18499 typedef value_type_ signature[n0_];
18500 typedef traits_type_ traits_type;
18501 typedef value_type_ value_type;
18502 typedef const value_type_& const_reference;
18503 typedef value_type_& reference;
18504
18505 typedef typename array_signature_traits<const signature>::default_rev_iterator const_iterator;
18506 typedef typename array_signature_traits<signature>::default_rev_iterator iterator;
18507 typedef typename array_signature_traits<signature>::size_type size_type;
18508
18509 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
18510 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
18511 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
18512
18513 static const int dimensions = 1;
18514 static const bool is_reverse = true;
18515 static const int internal_buffer_size = internal_buf_size_;
18516
18517 LITE_INLINE array()
18518 {
18519 init();
18520 resize(size_type());
18521 }
18522
18523 explicit LITE_INLINE array(int n0)
18524 {
18525 init();
18526 resize(size_type(n0));
18527 }
18528
18529 explicit LITE_INLINE array(const size_type& sz)
18530 {
18531 init();
18532 resize(sz);
18533 }
18534
18535 LITE_INLINE array(const array& other)
18536 {
18537 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
18538
18539 init();
18540 resize(other.size());
18541 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
18542 }
18543
18544 template<typename other_rep_>
18545 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
18546 {
18547 typedef b_iterator<
18548 iterator,
18549 typename array<signature, traits_type_, other_rep_>::const_iterator,
18550 assign<value_type> >
18551 iterator_type;
18552
18553 init();
18554 resize(other.size());
18555 for_each(iterator_type(m_iterator, other.begin()), m_size);
18556 }
18557
18558 LITE_INLINE array(const value_type& value)
18559 {
18560 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
18561
18562 init();
18563 for_each(iterator_type(m_iterator, value), m_size);
18564 }
18565
18566 LITE_INLINE array& operator=(const array& other)
18567 {
18568 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
18569
18570 resize(other.size());
18571 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
18572 return *this;
18573 }
18574
18575 template<typename other_rep_>
18576 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
18577 {
18578 typedef b_iterator<
18579 iterator,
18580 typename array<signature, traits_type_, other_rep_>::const_iterator,
18581 assign<value_type> >
18582 iterator_type;
18583
18584 resize(other.size());
18585 for_each(iterator_type(m_iterator, other.begin()), m_size);
18586 return *this;
18587 }
18588
18589 LITE_INLINE array& operator=(const value_type& value)
18590 {
18591 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
18592
18593 for_each(iterator_type(m_iterator, value), m_size);
18594 return *this;
18595 }
18596
18597 LITE_INLINE const_iterator begin() const
18598 {
18599 return m_iterator;
18600 }
18601
18602 LITE_INLINE iterator begin()
18603 {
18604 return m_iterator;
18605 }
18606
18607 LITE_INLINE size_type size() const
18608 {
18609 return m_size;
18610 }
18611
18612 LITE_INLINE const_reference
18613 operator()(int i0) const
18614 {
18615 return *(m_iterator.i0+i0*m_iterator.i1);
18616 }
18617
18618 LITE_INLINE reference
18619 operator()(int i0)
18620 {
18621 return *(m_iterator.i0+i0*m_iterator.i1);
18622 }
18623
18624 LITE_INLINE const_reference
18625 operator[](int i0) const
18626 {
18627 return *(m_iterator.i0+i0*m_iterator.i1);
18628 }
18629
18630 LITE_INLINE reference
18631 operator[](int i0)
18632 {
18633 return *(m_iterator.i0+i0*m_iterator.i1);
18634 }
18635
18636
18637 template<typename transform_type_>
18638 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
18639 operator[](const transform_type_& trans) const
18640 {
18641 typedef typename transform_traits<array, transform_type_>::const_array result_type;
18642
18643 return result_type(begin(), size(), trans);
18644 }
18645
18646 template<typename transform_type_>
18647 LITE_INLINE const typename transform_traits<array, transform_type_>::array
18648 operator[](const transform_type_& trans)
18649 {
18650 typedef typename transform_traits<array, transform_type_>::array result_type;
18651
18652 return result_type(begin(), size(), trans);
18653 }
18654
18655 LITE_INLINE const value_type* data() const
18656 {
18657 return m_iterator.i0;
18658 }
18659
18660 LITE_INLINE value_type* data()
18661 {
18662 return m_iterator.i0;
18663 }
18664
18665 LITE_INLINE void release()
18666 {
18667 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18668 delete[] m_iterator.i0;
18669
18670 m_iterator.i0 = 0;
18671 m_size.set(0);
18672 }
18673
18674 LITE_INLINE void resize(int n0)
18675 {
18676 resize(size_type(n0));
18677 }
18678
18679 LITE_INLINE void resize(const size_type& new_size)
18680 {
18681 int old_volumne = volume(m_size);
18682 int new_volume = volume(new_size);
18683
18684 if (old_volumne != new_volume || m_iterator.i0==0) {
18685 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18686 delete[] m_iterator.i0;
18687 m_iterator.i0 = 0;
18688 m_size.set(0);
18689
18690 if (new_volume == 0)
18691 return;
18692
18693 m_iterator.i0 = new_volume <= internal_buffer_size ? m_buffer : new value_type[new_volume];
18694 }
18695 m_size = new_size;
18696 m_iterator.set(
18697 m_iterator.i0,
18698 1
18699 );
18700 }
18701
18702 template<typename other_rep_>
18703 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
18704 {
18705 regular_swap(other);
18706 }
18707
18708 template<typename other_rep_>
18709 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
18710 {
18711 regular_swap(other);
18712 }
18713
18714 LITE_INLINE void swap(array& other)
18715 {
18716
18717 if (m_iterator.i0 != m_buffer && other.m_iterator.i0 != other.m_buffer) {
18718 iterator tmp_iter = other.m_iterator;
18719 size_type tmp_size = other.m_size;
18720
18721 other.m_iterator = m_iterator;
18722 other.m_size = m_size;
18723
18724 m_iterator = tmp_iter;
18725 m_size = tmp_size;
18726 }
18727 else
18728 regular_swap(other);
18729 }
18730
18731
18732 LITE_INLINE ~array()
18733 {
18734 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18735 delete[] m_iterator.i0;
18736 }
18737
18738 private:
18739
18740 template<typename other_array_>
18741 LITE_INLINE void regular_swap(other_array_& other)
18742 {
18743 typedef b_iterator<iterator, typename other_array_::iterator, swapper<value_type> > iterator_type;
18744
18745 if (m_size == other.size())
18746 for_each(iterator_type(m_iterator, other.begin()), m_size);
18747 else {
18748 typename other_array_::temporary_array tmp = other;
18749
18750 other = *this;
18751 *this = tmp;
18752 }
18753 }
18754
18755
18756
18757
18758 LITE_INLINE void init()
18759 {
18760 m_iterator.i0 = 0;
18761 m_size.set(0);
18762 resize(m_size);
18763 }
18764
18765 iterator m_iterator;
18766 size_type m_size;
18767 value_type m_buffer[internal_buffer_size >= 1 ? internal_buffer_size : 1];
18768 };
18769
18770
18771
18772 template<
18773 typename value_type_,
18774 int n0_,
18775 int n1_,
18776 typename traits_type_,
18777 int internal_buf_size_
18778 >
18779 class array<
18780 value_type_[n0_][n1_],
18781 traits_type_,
18782 hybrid_rep<true, internal_buf_size_>
18783 >
18784 {
18785 public:
18786 typedef value_type_ signature[n0_][n1_];
18787 typedef traits_type_ traits_type;
18788 typedef value_type_ value_type;
18789 typedef const value_type_& const_reference;
18790 typedef value_type_& reference;
18791
18792 typedef typename array_signature_traits<const signature>::default_rev_iterator const_iterator;
18793 typedef typename array_signature_traits<signature>::default_rev_iterator iterator;
18794 typedef typename array_signature_traits<signature>::size_type size_type;
18795
18796 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
18797 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
18798 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
18799
18800 static const int dimensions = 2;
18801 static const bool is_reverse = true;
18802 static const int internal_buffer_size = internal_buf_size_;
18803
18804 LITE_INLINE array()
18805 {
18806 init();
18807 resize(size_type());
18808 }
18809
18810 explicit LITE_INLINE array(int n0, int n1)
18811 {
18812 init();
18813 resize(size_type(n0, n1));
18814 }
18815
18816 explicit LITE_INLINE array(const size_type& sz)
18817 {
18818 init();
18819 resize(sz);
18820 }
18821
18822 LITE_INLINE array(const array& other)
18823 {
18824 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
18825
18826 init();
18827 resize(other.size());
18828 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
18829 }
18830
18831 template<typename other_rep_>
18832 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
18833 {
18834 typedef b_iterator<
18835 iterator,
18836 typename array<signature, traits_type_, other_rep_>::const_iterator,
18837 assign<value_type> >
18838 iterator_type;
18839
18840 init();
18841 resize(other.size());
18842 for_each(iterator_type(m_iterator, other.begin()), m_size);
18843 }
18844
18845 LITE_INLINE array(const value_type& value)
18846 {
18847 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
18848
18849 init();
18850 for_each(iterator_type(m_iterator, value), m_size);
18851 }
18852
18853 LITE_INLINE array& operator=(const array& other)
18854 {
18855 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
18856
18857 resize(other.size());
18858 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
18859 return *this;
18860 }
18861
18862 template<typename other_rep_>
18863 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
18864 {
18865 typedef b_iterator<
18866 iterator,
18867 typename array<signature, traits_type_, other_rep_>::const_iterator,
18868 assign<value_type> >
18869 iterator_type;
18870
18871 resize(other.size());
18872 for_each(iterator_type(m_iterator, other.begin()), m_size);
18873 return *this;
18874 }
18875
18876 LITE_INLINE array& operator=(const value_type& value)
18877 {
18878 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
18879
18880 for_each(iterator_type(m_iterator, value), m_size);
18881 return *this;
18882 }
18883
18884 LITE_INLINE const_iterator begin() const
18885 {
18886 return m_iterator;
18887 }
18888
18889 LITE_INLINE iterator begin()
18890 {
18891 return m_iterator;
18892 }
18893
18894 LITE_INLINE size_type size() const
18895 {
18896 return m_size;
18897 }
18898
18899 LITE_INLINE const_reference
18900 operator()(int i0, int i1) const
18901 {
18902 return *(m_iterator.i0+i0*m_iterator.i1+i1*m_iterator.i2);
18903 }
18904
18905 LITE_INLINE reference
18906 operator()(int i0, int i1)
18907 {
18908 return *(m_iterator.i0+i0*m_iterator.i1+i1*m_iterator.i2);
18909 }
18910
18911
18912 template<typename transform_type_>
18913 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
18914 operator[](const transform_type_& trans) const
18915 {
18916 typedef typename transform_traits<array, transform_type_>::const_array result_type;
18917
18918 return result_type(begin(), size(), trans);
18919 }
18920
18921 template<typename transform_type_>
18922 LITE_INLINE const typename transform_traits<array, transform_type_>::array
18923 operator[](const transform_type_& trans)
18924 {
18925 typedef typename transform_traits<array, transform_type_>::array result_type;
18926
18927 return result_type(begin(), size(), trans);
18928 }
18929
18930 LITE_INLINE const value_type* data() const
18931 {
18932 return m_iterator.i0;
18933 }
18934
18935 LITE_INLINE value_type* data()
18936 {
18937 return m_iterator.i0;
18938 }
18939
18940 LITE_INLINE void release()
18941 {
18942 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18943 delete[] m_iterator.i0;
18944
18945 m_iterator.i0 = 0;
18946 m_size.set(0, 0);
18947 }
18948
18949 LITE_INLINE void resize(int n0, int n1)
18950 {
18951 resize(size_type(n0, n1));
18952 }
18953
18954 LITE_INLINE void resize(const size_type& new_size)
18955 {
18956 int old_volumne = volume(m_size);
18957 int new_volume = volume(new_size);
18958
18959 if (old_volumne != new_volume || m_iterator.i0==0) {
18960 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
18961 delete[] m_iterator.i0;
18962 m_iterator.i0 = 0;
18963 m_size.set(0, 0);
18964
18965 if (new_volume == 0)
18966 return;
18967
18968 m_iterator.i0 = new_volume <= internal_buffer_size ? m_buffer : new value_type[new_volume];
18969 }
18970 m_size = new_size;
18971 m_iterator.set(
18972 m_iterator.i0,
18973 1,
18974 m_size.i0
18975 );
18976 }
18977
18978 template<typename other_rep_>
18979 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
18980 {
18981 regular_swap(other);
18982 }
18983
18984 template<typename other_rep_>
18985 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
18986 {
18987 regular_swap(other);
18988 }
18989
18990 LITE_INLINE void swap(array& other)
18991 {
18992
18993 if (m_iterator.i0 != m_buffer && other.m_iterator.i0 != other.m_buffer) {
18994 iterator tmp_iter = other.m_iterator;
18995 size_type tmp_size = other.m_size;
18996
18997 other.m_iterator = m_iterator;
18998 other.m_size = m_size;
18999
19000 m_iterator = tmp_iter;
19001 m_size = tmp_size;
19002 }
19003 else
19004 regular_swap(other);
19005 }
19006
19007
19008 LITE_INLINE ~array()
19009 {
19010 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
19011 delete[] m_iterator.i0;
19012 }
19013
19014 private:
19015
19016 template<typename other_array_>
19017 LITE_INLINE void regular_swap(other_array_& other)
19018 {
19019 typedef b_iterator<iterator, typename other_array_::iterator, swapper<value_type> > iterator_type;
19020
19021 if (m_size == other.size())
19022 for_each(iterator_type(m_iterator, other.begin()), m_size);
19023 else {
19024 typename other_array_::temporary_array tmp = other;
19025
19026 other = *this;
19027 *this = tmp;
19028 }
19029 }
19030
19031
19032
19033
19034 LITE_INLINE void init()
19035 {
19036 m_iterator.i0 = 0;
19037 m_size.set(0, 0);
19038 resize(m_size);
19039 }
19040
19041 iterator m_iterator;
19042 size_type m_size;
19043 value_type m_buffer[internal_buffer_size >= 1 ? internal_buffer_size : 1];
19044 };
19045
19046
19047
19048 template<
19049 typename value_type_,
19050 int n0_,
19051 int n1_,
19052 int n2_,
19053 typename traits_type_,
19054 int internal_buf_size_
19055 >
19056 class array<
19057 value_type_[n0_][n1_][n2_],
19058 traits_type_,
19059 hybrid_rep<true, internal_buf_size_>
19060 >
19061 {
19062 public:
19063 typedef value_type_ signature[n0_][n1_][n2_];
19064 typedef traits_type_ traits_type;
19065 typedef value_type_ value_type;
19066 typedef const value_type_& const_reference;
19067 typedef value_type_& reference;
19068
19069 typedef typename array_signature_traits<const signature>::default_rev_iterator const_iterator;
19070 typedef typename array_signature_traits<signature>::default_rev_iterator iterator;
19071 typedef typename array_signature_traits<signature>::size_type size_type;
19072
19073 typedef typename array_helper<signature, traits_type_>::temporary_array temporary_array;
19074 typedef typename array_helper<signature, traits_type_>::fwd_temporary_array fwd_temporary_array;
19075 typedef typename array_helper<signature, traits_type_>::rev_temporary_array rev_temporary_array;
19076
19077 static const int dimensions = 3;
19078 static const bool is_reverse = true;
19079 static const int internal_buffer_size = internal_buf_size_;
19080
19081 LITE_INLINE array()
19082 {
19083 init();
19084 resize(size_type());
19085 }
19086
19087 explicit LITE_INLINE array(int n0, int n1, int n2)
19088 {
19089 init();
19090 resize(size_type(n0, n1, n2));
19091 }
19092
19093 explicit LITE_INLINE array(const size_type& sz)
19094 {
19095 init();
19096 resize(sz);
19097 }
19098
19099 LITE_INLINE array(const array& other)
19100 {
19101 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
19102
19103 init();
19104 resize(other.size());
19105 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
19106 }
19107
19108 template<typename other_rep_>
19109 LITE_INLINE array(const array<signature, traits_type_, other_rep_>& other)
19110 {
19111 typedef b_iterator<
19112 iterator,
19113 typename array<signature, traits_type_, other_rep_>::const_iterator,
19114 assign<value_type> >
19115 iterator_type;
19116
19117 init();
19118 resize(other.size());
19119 for_each(iterator_type(m_iterator, other.begin()), m_size);
19120 }
19121
19122 LITE_INLINE array(const value_type& value)
19123 {
19124 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
19125
19126 init();
19127 for_each(iterator_type(m_iterator, value), m_size);
19128 }
19129
19130 LITE_INLINE array& operator=(const array& other)
19131 {
19132 typedef b_iterator<iterator, const_iterator, assign<value_type> > iterator_type;
19133
19134 resize(other.size());
19135 for_each(iterator_type(m_iterator, other.m_iterator), m_size);
19136 return *this;
19137 }
19138
19139 template<typename other_rep_>
19140 LITE_INLINE array& operator=(const array<signature, traits_type_, other_rep_>& other)
19141 {
19142 typedef b_iterator<
19143 iterator,
19144 typename array<signature, traits_type_, other_rep_>::const_iterator,
19145 assign<value_type> >
19146 iterator_type;
19147
19148 resize(other.size());
19149 for_each(iterator_type(m_iterator, other.begin()), m_size);
19150 return *this;
19151 }
19152
19153 LITE_INLINE array& operator=(const value_type& value)
19154 {
19155 typedef b_iterator<iterator, c_iterator<value_type>, assign<value_type> > iterator_type;
19156
19157 for_each(iterator_type(m_iterator, value), m_size);
19158 return *this;
19159 }
19160
19161 LITE_INLINE const_iterator begin() const
19162 {
19163 return m_iterator;
19164 }
19165
19166 LITE_INLINE iterator begin()
19167 {
19168 return m_iterator;
19169 }
19170
19171 LITE_INLINE size_type size() const
19172 {
19173 return m_size;
19174 }
19175
19176 LITE_INLINE const_reference
19177 operator()(int i0, int i1, int i2) const
19178 {
19179 return *(m_iterator.i0+i0*m_iterator.i1+i1*m_iterator.i2+i2*m_iterator.i3);
19180 }
19181
19182 LITE_INLINE reference
19183 operator()(int i0, int i1, int i2)
19184 {
19185 return *(m_iterator.i0+i0*m_iterator.i1+i1*m_iterator.i2+i2*m_iterator.i3);
19186 }
19187
19188
19189 template<typename transform_type_>
19190 LITE_INLINE const typename transform_traits<array, transform_type_>::const_array
19191 operator[](const transform_type_& trans) const
19192 {
19193 typedef typename transform_traits<array, transform_type_>::const_array result_type;
19194
19195 return result_type(begin(), size(), trans);
19196 }
19197
19198 template<typename transform_type_>
19199 LITE_INLINE const typename transform_traits<array, transform_type_>::array
19200 operator[](const transform_type_& trans)
19201 {
19202 typedef typename transform_traits<array, transform_type_>::array result_type;
19203
19204 return result_type(begin(), size(), trans);
19205 }
19206
19207 LITE_INLINE const value_type* data() const
19208 {
19209 return m_iterator.i0;
19210 }
19211
19212 LITE_INLINE value_type* data()
19213 {
19214 return m_iterator.i0;
19215 }
19216
19217 LITE_INLINE void release()
19218 {
19219 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
19220 delete[] m_iterator.i0;
19221
19222 m_iterator.i0 = 0;
19223 m_size.set(0, 0, 0);
19224 }
19225
19226 LITE_INLINE void resize(int n0, int n1, int n2)
19227 {
19228 resize(size_type(n0, n1, n2));
19229 }
19230
19231 LITE_INLINE void resize(const size_type& new_size)
19232 {
19233 int old_volumne = volume(m_size);
19234 int new_volume = volume(new_size);
19235
19236 if (old_volumne != new_volume || m_iterator.i0==0) {
19237 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
19238 delete[] m_iterator.i0;
19239 m_iterator.i0 = 0;
19240 m_size.set(0, 0, 0);
19241
19242 if (new_volume == 0)
19243 return;
19244
19245 m_iterator.i0 = new_volume <= internal_buffer_size ? m_buffer : new value_type[new_volume];
19246 }
19247 m_size = new_size;
19248 m_iterator.set(
19249 m_iterator.i0,
19250 1,
19251 m_size.i0,
19252 m_size.i0*m_size.i1
19253 );
19254 }
19255
19256 template<typename other_rep_>
19257 LITE_INLINE void swap(const array<signature, traits_type_, other_rep_>& other)
19258 {
19259 regular_swap(other);
19260 }
19261
19262 template<typename other_rep_>
19263 LITE_INLINE void swap(array<signature, traits_type_, other_rep_>& other)
19264 {
19265 regular_swap(other);
19266 }
19267
19268 LITE_INLINE void swap(array& other)
19269 {
19270
19271 if (m_iterator.i0 != m_buffer && other.m_iterator.i0 != other.m_buffer) {
19272 iterator tmp_iter = other.m_iterator;
19273 size_type tmp_size = other.m_size;
19274
19275 other.m_iterator = m_iterator;
19276 other.m_size = m_size;
19277
19278 m_iterator = tmp_iter;
19279 m_size = tmp_size;
19280 }
19281 else
19282 regular_swap(other);
19283 }
19284
19285
19286 LITE_INLINE ~array()
19287 {
19288 if (m_iterator.i0 && m_iterator.i0 != m_buffer)
19289 delete[] m_iterator.i0;
19290 }
19291
19292 private:
19293
19294 template<typename other_array_>
19295 LITE_INLINE void regular_swap(other_array_& other)
19296 {
19297 typedef b_iterator<iterator, typename other_array_::iterator, swapper<value_type> > iterator_type;
19298
19299 if (m_size == other.size())
19300 for_each(iterator_type(m_iterator, other.begin()), m_size);
19301 else {
19302 typename other_array_::temporary_array tmp = other;
19303
19304 other = *this;
19305 *this = tmp;
19306 }
19307 }
19308
19309
19310
19311
19312 LITE_INLINE void init()
19313 {
19314 m_iterator.i0 = 0;
19315 m_size.set(0, 0, 0);
19316 resize(m_size);
19317 }
19318
19319 iterator m_iterator;
19320 size_type m_size;
19321 value_type m_buffer[internal_buffer_size >= 1 ? internal_buffer_size : 1];
19322 };
19323
19324
19325
19326
19327
19328
19329
19330
19331 #ifdef DOCUMENTATION_ONLY
19332
19361 template<typename array_type_, typename trans_type_>
19362 struct transform_traits
19363 {
19365 typedef typename size_transformer<trans_type_, typename array_type_::size_type>::size_type size_type;
19366
19368 typedef typename detail::size_to_signature<size_type, typename array_type_::value_type>::type signature;
19369
19371 typedef typename array_type_::traits_type traits_type;
19372
19374 typedef typename iterator_transformer<
19375 trans_type_,
19376 typename array_type_::iterator,
19377 typename array_type_::size_type>::iterator_type iterator;
19378
19380 typedef typename iterator_transformer<
19381 trans_type_,
19382 typename array_type_::const_iterator,
19383 typename array_type_::size_type>::iterator_type const_iterator;
19384
19386 typedef ::lite::array<signature, traits_type, reference_rep<iterator> > array;
19387
19389 typedef ::lite::array<signature, traits_type, reference_rep<const_iterator> > const_array;
19390
19396 typedef typename array_helper<signature, traits_type>::temporary_array temporary_array;
19397
19403 typedef typename array_helper<signature, traits_type>::fwd_temporary_array fwd_temporary_array;
19404
19410 typedef typename array_helper<signature, traits_type>::rev_temporary_array rev_temporary_array;
19411 };
19412
19413 #else // DOCUMENTATION_ONLY
19414
19415 template<typename array_type_, typename trans_type_>
19416 struct transform_traits<
19417 array_type_,
19418 trans_type_,
19419 typename detail::enable_if<
19420 detail::defined<typename size_transformer<trans_type_,
19421 typename array_type_::size_type>::size_type>::value
19422 >::type
19423 >
19424 {
19425 typedef typename size_transformer<trans_type_, typename array_type_::size_type>::size_type size_type;
19426 typedef typename detail::size_to_signature<size_type, typename array_type_::value_type>::type signature;
19427 typedef typename array_type_::traits_type traits_type;
19428
19429 typedef typename iterator_transformer<
19430 trans_type_,
19431 typename array_type_::iterator,
19432 typename array_type_::size_type>::iterator_type iterator;
19433
19434 typedef typename iterator_transformer<
19435 trans_type_,
19436 typename array_type_::const_iterator,
19437 typename array_type_::size_type>::iterator_type const_iterator;
19438
19439 typedef ::lite::array<signature, traits_type, reference_rep<iterator> > array;
19440 typedef ::lite::array<signature, traits_type, reference_rep<const_iterator> > const_array;
19441
19442 typedef typename array_helper<signature, traits_type>::temporary_array temporary_array;
19443 typedef typename array_helper<signature, traits_type>::fwd_temporary_array fwd_temporary_array;
19444 typedef typename array_helper<signature, traits_type>::rev_temporary_array rev_temporary_array;
19445 };
19446
19447 #endif // DOCUMENTATION_ONLY
19448
19449
19450
19451
19452
19453 template<typename type_>
19454 class uplus
19455 {
19456 public:
19457 typedef type_ argument_type;
19458 typedef type_ result_type;
19459
19460 LITE_INLINE result_type operator()(const argument_type& a) const
19461 { return +a; }
19462 };
19463
19464 template<typename type_>
19465 class negate
19466 {
19467 public:
19468 typedef type_ argument_type;
19469 typedef type_ result_type;
19470
19471 LITE_INLINE result_type operator()(const argument_type& a) const
19472 { return -a; }
19473 };
19474
19475 template<typename type_>
19476 class plus
19477 {
19478 public:
19479 typedef type_ first_argument_type;
19480 typedef type_ second_argument_type;
19481 typedef type_ result_type;
19482
19483 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19484 { return a + b; }
19485 };
19486
19487 template<typename type_>
19488 class minus
19489 {
19490 public:
19491 typedef type_ first_argument_type;
19492 typedef type_ second_argument_type;
19493 typedef type_ result_type;
19494
19495 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19496 { return a - b; }
19497 };
19498
19499 template<typename type_>
19500 class multiplies
19501 {
19502 public:
19503 typedef type_ first_argument_type;
19504 typedef type_ second_argument_type;
19505 typedef type_ result_type;
19506
19507 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19508 { return a*b; }
19509 };
19510
19511 template<typename type_>
19512 class divides
19513 {
19514 public:
19515 typedef type_ first_argument_type;
19516 typedef type_ second_argument_type;
19517 typedef type_ result_type;
19518
19519 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19520 { return a/b; }
19521 };
19522
19523 template<typename type_>
19524 class assign
19525 {
19526 public:
19527 typedef type_ first_argument_type;
19528 typedef type_ second_argument_type;
19529 typedef type_& result_type;
19530
19531 LITE_INLINE result_type operator()(first_argument_type& a, const second_argument_type& b) const
19532 { return a = b; }
19533 };
19534
19535 template<typename type_>
19536 class plus_assign
19537 {
19538 public:
19539 typedef type_ first_argument_type;
19540 typedef type_ second_argument_type;
19541 typedef type_& result_type;
19542
19543 LITE_INLINE result_type operator()(first_argument_type& a, const second_argument_type& b) const
19544 { return a += b; }
19545 };
19546
19547 template<typename type_>
19548 class minus_assign
19549 {
19550 public:
19551 typedef type_ first_argument_type;
19552 typedef type_ second_argument_type;
19553 typedef type_& result_type;
19554
19555 LITE_INLINE result_type operator()(first_argument_type& a, const second_argument_type& b) const
19556 { return a -= b; }
19557 };
19558
19559 template<typename type_>
19560 class multiplies_assign
19561 {
19562 public:
19563 typedef type_ first_argument_type;
19564 typedef type_ second_argument_type;
19565 typedef type_& result_type;
19566
19567 LITE_INLINE result_type operator()(first_argument_type& a, const second_argument_type& b) const
19568 { return a *= b; }
19569 };
19570
19571 template<typename type_>
19572 class divides_assign
19573 {
19574 public:
19575 typedef type_ first_argument_type;
19576 typedef type_ second_argument_type;
19577 typedef type_& result_type;
19578
19579 LITE_INLINE result_type operator()(first_argument_type& a, const second_argument_type& b) const
19580 { return a /= b; }
19581 };
19582
19583 template<typename type_>
19584 class minimum
19585 {
19586 public:
19587 typedef type_ first_argument_type;
19588 typedef type_ second_argument_type;
19589 typedef const type_& result_type;
19590
19591 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19592 { return a < b ? a : b; }
19593 };
19594
19595 template<typename type_>
19596 class maximum
19597 {
19598 public:
19599 typedef type_ first_argument_type;
19600 typedef type_ second_argument_type;
19601 typedef const type_& result_type;
19602
19603 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19604 { return a > b ? a : b; }
19605 };
19606
19607 template<typename type_>
19608 class square
19609 {
19610 public:
19611 typedef type_ argument_type;
19612 typedef type_ result_type;
19613
19614 LITE_INLINE result_type operator()(const argument_type& a) const
19615 { return a*a; }
19616 };
19617
19618 template<typename type_>
19619 class less
19620 {
19621 public:
19622 typedef type_ first_argument_type;
19623 typedef type_ second_argument_type;
19624 typedef bool result_type;
19625
19626 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19627 { return a < b; }
19628 };
19629
19630 template<typename type_>
19631 class less_equal
19632 {
19633 public:
19634 typedef type_ first_argument_type;
19635 typedef type_ second_argument_type;
19636 typedef bool result_type;
19637
19638 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19639 { return a <= b; }
19640 };
19641
19642 template<typename type_>
19643 class equal_to
19644 {
19645 public:
19646 typedef type_ first_argument_type;
19647 typedef type_ second_argument_type;
19648 typedef bool result_type;
19649
19650 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19651 { return a == b; }
19652 };
19653
19654 template<typename type_>
19655 class greater_equal
19656 {
19657 public:
19658 typedef type_ first_argument_type;
19659 typedef type_ second_argument_type;
19660 typedef bool result_type;
19661
19662 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19663 { return a >= b; }
19664 };
19665
19666 template<typename type_>
19667 class greater
19668 {
19669 public:
19670 typedef type_ first_argument_type;
19671 typedef type_ second_argument_type;
19672 typedef bool result_type;
19673
19674 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19675 { return a > b; }
19676 };
19677
19678 template<typename type_>
19679 class compare3
19680 {
19681 public:
19682 typedef type_ first_argument_type;
19683 typedef type_ second_argument_type;
19684 typedef int result_type;
19685
19686 LITE_INLINE result_type operator()(const first_argument_type& a, const second_argument_type& b) const
19687 { return a < b ? -1 : b < a ? 1 : 0; }
19688 };
19689
19690 template<typename type_>
19691 class round
19692 {
19693 public:
19694 typedef type_ argument_type;
19695 typedef type_ result_type;
19696
19697 round(const type_& normal = type_(1)) : m_normal(normal) {}
19698
19699 LITE_INLINE result_type operator()(const argument_type& a) const
19700 { return (a+m_normal)-m_normal; }
19701
19702 private:
19703 type_ m_normal;
19704 };
19705
19706 template<typename type_>
19707 class accumulator
19708 {
19709 public:
19710 typedef type_ argument_type;
19711 typedef void result_type;
19712
19713 LITE_INLINE accumulator(const type_& value = type_())
19714 : m_value(value)
19715 {}
19716
19717 LITE_INLINE accumulator(const accumulator& other)
19718 : m_value(other.m_value)
19719 {}
19720
19721 LITE_INLINE accumulator& operator=(const accumulator& other)
19722 {
19723 m_value = other.m_value;
19724 return *this;
19725 }
19726
19727 LITE_INLINE void operator()(const argument_type& a)
19728 {
19729 m_value += a;
19730 }
19731
19732 LITE_INLINE type_ operator()() const
19733 {
19734 return m_value;
19735 }
19736
19737 private:
19738 type_ m_value;
19739 };
19740
19741 template<typename type_>
19742 class while_equal
19743 {
19744 public:
19745 typedef type_ argument_type;
19746 typedef bool result_type;
19747
19748 LITE_INLINE while_equal(): m_result() {}
19749
19750 LITE_INLINE while_equal(const while_equal& other) : m_result(other.m_result) {}
19751
19752 LITE_INLINE while_equal& operator=(const while_equal& other)
19753 {
19754 m_result = other.m_result;
19755 return *this;
19756 }
19757
19758 LITE_INLINE result_type operator()(const argument_type& a)
19759 {
19760 if (a == 0)
19761 return true;
19762
19763 m_result = a;
19764 return false;
19765 }
19766
19767 LITE_INLINE argument_type operator()() const
19768 {
19769 return m_result;
19770 }
19771
19772 private:
19773 argument_type m_result;
19774 };
19775
19776
19777 template<typename type_>
19778 class swapper
19779 {
19780 public:
19781 typedef type_ first_argument_type;
19782 typedef type_ second_argument_type;
19783 typedef bool result_type;
19784
19785 LITE_INLINE result_type operator()(first_argument_type& a, second_argument_type& b) const
19786 {
19787 std::swap(a, b);
19788 return true;
19789 }
19790 };
19791
19792
19793
19794
19795
19796 template<typename func_type_, typename signature_, typename traits_type_, typename rep_>
19797 LITE_INLINE array<signature_, traits_type_, reference_rep<u_iterator<
19798 typename array<signature_,traits_type_, rep_>::const_iterator,
19799 func_type_>
19800 > >
19801 apply(const array<signature_, traits_type_, rep_>& a)
19802 {
19803 typedef array<signature_, traits_type_, reference_rep<u_iterator<
19804 typename array<signature_,traits_type_, rep_>::const_iterator,
19805 func_type_> >
19806 > result_type;
19807
19808 return result_type(a.begin(), a.size());
19809 }
19810
19811 template<typename func_type_, typename signature_, typename traits_type_, typename rep_>
19812 LITE_INLINE array<signature_, traits_type_, reference_rep<u_iterator<
19813 typename array<signature_,traits_type_, rep_>::iterator,
19814 func_type_>
19815 > >
19816 apply(array<signature_, traits_type_, rep_>& a)
19817 {
19818 typedef array<signature_, traits_type_, reference_rep<u_iterator<
19819 typename array<signature_,traits_type_, rep_>::iterator,
19820 func_type_> >
19821 > result_type;
19822
19823 return result_type(a.begin(), a.size());
19824 }
19825
19826
19827
19828
19829
19830 template<typename func_type_, typename signature_, typename traits_type_, typename rep_>
19831 LITE_INLINE array<signature_, traits_type_, reference_rep<u_iterator<
19832 typename array<signature_,traits_type_, rep_>::const_iterator,
19833 func_type_,
19834 false>
19835 > >
19836 apply(const array<signature_, traits_type_, rep_>& a, const func_type_& func)
19837 {
19838 typedef array<signature_, traits_type_, reference_rep<u_iterator<
19839 typename array<signature_,traits_type_, rep_>::const_iterator,
19840 func_type_,
19841 false> >
19842 > result_type;
19843
19844 return result_type(a.begin(), func, a.size());
19845 }
19846
19847 template<typename func_type_, typename signature_, typename traits_type_, typename rep_>
19848 LITE_INLINE array<signature_, traits_type_, reference_rep<u_iterator<
19849 typename array<signature_,traits_type_, rep_>::iterator,
19850 func_type_,
19851 false>
19852 > >
19853 apply(array<signature_, traits_type_, rep_>& a, const func_type_& func)
19854 {
19855 typedef array<signature_, traits_type_, reference_rep<u_iterator<
19856 typename array<signature_,traits_type_, rep_>::iterator,
19857 func_type_,
19858 false> >
19859 > result_type;
19860
19861 return result_type(a.begin(), func, a.size());
19862 }
19863
19864
19865
19866
19867
19868
19869 template<typename func_type_, typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
19870 LITE_INLINE
19871 array<signature_, traits_type_, reference_rep<b_iterator<
19872 typename array<signature_,traits_type_, l_rep_>::const_iterator,
19873 typename array<signature_,traits_type_, r_rep_>::const_iterator,
19874 func_type_>
19875 > >
19876 apply(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
19877 {
19878 typedef array<signature_, traits_type_, reference_rep<b_iterator<
19879 typename array<signature_,traits_type_, l_rep_>::const_iterator,
19880 typename array<signature_,traits_type_, r_rep_>::const_iterator,
19881 func_type_
19882 > > > result_type;
19883
19884 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "apply<F>(A,A): array sizes do not match");
19885 return result_type(a.begin(), b.begin(), a.size());
19886 }
19887
19888 template<typename func_type_, typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
19889 LITE_INLINE
19890 array<signature_, traits_type_, reference_rep<b_iterator<
19891 typename array<signature_,traits_type_, l_rep_>::iterator,
19892 typename array<signature_,traits_type_, r_rep_>::const_iterator,
19893 func_type_>
19894 > >
19895 apply(array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
19896 {
19897 typedef array<signature_, traits_type_, reference_rep<b_iterator<
19898 typename array<signature_,traits_type_, l_rep_>::iterator,
19899 typename array<signature_,traits_type_, r_rep_>::const_iterator,
19900 func_type_
19901 > > > result_type;
19902
19903 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "apply<F>(A,A): array sizes do not match");
19904 return result_type(a.begin(), b.begin(), a.size());
19905 }
19906
19907 template<typename func_type_, typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
19908 LITE_INLINE
19909 array<signature_, traits_type_, reference_rep<b_iterator<
19910 typename array<signature_,traits_type_, l_rep_>::const_iterator,
19911 typename array<signature_,traits_type_, r_rep_>::iterator,
19912 func_type_>
19913 > >
19914 apply(const array<signature_, traits_type_, l_rep_>& a, array<signature_, traits_type_, r_rep_>& b)
19915 {
19916 typedef array<signature_, traits_type_, reference_rep<b_iterator<
19917 typename array<signature_,traits_type_, l_rep_>::const_iterator,
19918 typename array<signature_,traits_type_, r_rep_>::iterator,
19919 func_type_
19920 > > > result_type;
19921
19922 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "apply<F>(A,A): array sizes do not match");
19923 return result_type(a.begin(), b.begin(), a.size());
19924 }
19925
19926 template<typename func_type_, typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
19927 LITE_INLINE
19928 array<signature_, traits_type_, reference_rep<b_iterator<
19929 typename array<signature_,traits_type_, l_rep_>::iterator,
19930 typename array<signature_,traits_type_, r_rep_>::iterator,
19931 func_type_>
19932 > >
19933 apply(array<signature_, traits_type_, l_rep_>& a, array<signature_, traits_type_, r_rep_>& b)
19934 {
19935 typedef array<signature_, traits_type_, reference_rep<b_iterator<
19936 typename array<signature_,traits_type_, l_rep_>::iterator,
19937 typename array<signature_,traits_type_, r_rep_>::iterator,
19938 func_type_
19939 > > > result_type;
19940
19941 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "apply<F>(A,A): array sizes do not match");
19942 return result_type(a.begin(), b.begin(), a.size());
19943 }
19944
19945
19946
19947
19948
19949 template<typename func_type_, typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
19950 LITE_INLINE
19951 array<signature_, traits_type_, reference_rep<b_iterator<
19952 typename array<signature_,traits_type_, l_rep_>::const_iterator,
19953 typename array<signature_,traits_type_, r_rep_>::const_iterator,
19954 func_type_>
19955 > >
19956 apply(
19957 const array<signature_, traits_type_, l_rep_>& a,
19958 const array<signature_, traits_type_, r_rep_>& b,
19959 const func_type_& func)
19960 {
19961 typedef array<signature_, traits_type_, reference_rep<b_iterator<
19962 typename array<signature_,traits_type_, l_rep_>::const_iterator,
19963 typename array<signature_,traits_type_, r_rep_>::const_iterator,
19964 func_type_,
19965 false
19966 > > > result_type;
19967
19968 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "apply(A,A,f): array sizes do not match");
19969 return result_type(a.begin(), b.begin(), func, a.size());
19970 }
19971
19972 template<typename func_type_, typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
19973 LITE_INLINE
19974 array<signature_, traits_type_, reference_rep<b_iterator<
19975 typename array<signature_,traits_type_, l_rep_>::iterator,
19976 typename array<signature_,traits_type_, r_rep_>::const_iterator,
19977 func_type_>
19978 > >
19979 apply(
19980 array<signature_, traits_type_, l_rep_>& a,
19981 const array<signature_, traits_type_, r_rep_>& b,
19982 const func_type_& func)
19983 {
19984 typedef array<signature_, traits_type_, reference_rep<b_iterator<
19985 typename array<signature_,traits_type_, l_rep_>::iterator,
19986 typename array<signature_,traits_type_, r_rep_>::const_iterator,
19987 func_type_,
19988 false
19989 > > > result_type;
19990
19991 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "apply(A,A,f): array sizes do not match");
19992 return result_type(a.begin(), b.begin(), func, a.size());
19993 }
19994
19995 template<typename func_type_, typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
19996 LITE_INLINE
19997 array<signature_, traits_type_, reference_rep<b_iterator<
19998 typename array<signature_,traits_type_, l_rep_>::const_iterator,
19999 typename array<signature_,traits_type_, r_rep_>::iterator,
20000 func_type_>
20001 > >
20002 apply(
20003 const array<signature_, traits_type_, l_rep_>& a,
20004 array<signature_, traits_type_, r_rep_>& b,
20005 const func_type_& func)
20006 {
20007 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20008 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20009 typename array<signature_,traits_type_, r_rep_>::iterator,
20010 func_type_,
20011 false
20012 > > > result_type;
20013
20014 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "apply(A,A,f): array sizes do not match");
20015 return result_type(a.begin(), b.begin(), func, a.size());
20016 }
20017
20018 template<typename func_type_, typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20019 LITE_INLINE
20020 array<signature_, traits_type_, reference_rep<b_iterator<
20021 typename array<signature_,traits_type_, l_rep_>::iterator,
20022 typename array<signature_,traits_type_, r_rep_>::iterator,
20023 func_type_>
20024 > >
20025 apply(
20026 array<signature_, traits_type_, l_rep_>& a,
20027 array<signature_, traits_type_, r_rep_>& b,
20028 const func_type_& func)
20029 {
20030 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20031 typename array<signature_,traits_type_, l_rep_>::iterator,
20032 typename array<signature_,traits_type_, r_rep_>::iterator,
20033 func_type_,
20034 false
20035 > > > result_type;
20036
20037 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "apply(A,A,f): array sizes do not match");
20038 return result_type(a.begin(), b.begin(), func, a.size());
20039 }
20040
20041
20042
20043
20044
20045 template<typename signature_, typename traits_type_, typename rep_>
20046 LITE_INLINE
20047 array<signature_, traits_type_, reference_rep<u_iterator<
20048 typename array<signature_,traits_type_, rep_>::const_iterator,
20049 uplus<typename array_signature_traits<signature_>::element_type>
20050 > > >
20051 operator+(const array<signature_, traits_type_, rep_>& a)
20052 {
20053 typedef array<signature_, traits_type_, reference_rep<u_iterator<
20054 typename array<signature_,traits_type_, rep_>::const_iterator,
20055 uplus<typename array_signature_traits<signature_>::element_type>
20056 > > > result_type;
20057
20058 return result_type(a.begin(), a.size());
20059 }
20060
20061
20062
20063
20064
20065 template<typename signature_, typename traits_type_, typename rep_>
20066 LITE_INLINE array<signature_, traits_type_, reference_rep<u_iterator<
20067 typename array<signature_,traits_type_, rep_>::const_iterator,
20068 negate<typename array_signature_traits<signature_>::element_type>
20069 > > >
20070 operator-(const array<signature_, traits_type_, rep_>& a)
20071 {
20072 typedef array<signature_, traits_type_, reference_rep<u_iterator<
20073 typename array<signature_,traits_type_, rep_>::const_iterator,
20074 negate<typename array_signature_traits<signature_>::element_type>
20075 > > > result_type;
20076
20077 return result_type(a.begin(), a.size());
20078 }
20079
20080
20081
20082
20083
20084 template<typename signature_, typename traits_type_, typename l_rep_>
20085 LITE_INLINE
20086 array<signature_, traits_type_, reference_rep<b_iterator<
20087 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20088 c_iterator<typename array_signature_traits<signature_>::element_type>,
20089 plus<typename array_signature_traits<signature_>::element_type>
20090 > > >
20091 operator+(
20092 const array<signature_, traits_type_, l_rep_>& a,
20093 const typename array_signature_traits<signature_>::element_type& b)
20094 {
20095 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20096 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20097 c_iterator<typename array_signature_traits<signature_>::element_type>,
20098 plus<typename array_signature_traits<signature_>::element_type>
20099 > > > result_type;
20100
20101 return result_type(a.begin(), b, a.size());
20102 }
20103
20104
20105
20106
20107
20108 template<typename signature_, typename traits_type_, typename r_rep_>
20109 LITE_INLINE
20110 array<signature_, traits_type_, reference_rep<b_iterator<
20111 c_iterator<typename array_signature_traits<signature_>::element_type>,
20112 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20113 plus<typename array_signature_traits<signature_>::element_type>
20114 > > >
20115 operator+(
20116 const typename array_signature_traits<signature_>::element_type& a,
20117 const array<signature_, traits_type_, r_rep_>& b)
20118 {
20119 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20120 c_iterator<typename array_signature_traits<signature_>::element_type>,
20121 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20122 plus<typename array_signature_traits<signature_>::element_type>
20123 > > > result_type;
20124
20125 return result_type(a, b.begin(), b.size());
20126 }
20127
20128
20129
20130
20131
20132 template<typename signature_, typename traits_type_, typename l_rep_>
20133 LITE_INLINE
20134 array<signature_, traits_type_, reference_rep<b_iterator<
20135 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20136 c_iterator<typename array_signature_traits<signature_>::element_type>,
20137 minus<typename array_signature_traits<signature_>::element_type>
20138 > > >
20139 operator-(
20140 const array<signature_, traits_type_, l_rep_>& a,
20141 const typename array_signature_traits<signature_>::element_type& b)
20142 {
20143 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20144 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20145 c_iterator<typename array_signature_traits<signature_>::element_type>,
20146 minus<typename array_signature_traits<signature_>::element_type>
20147 > > > result_type;
20148
20149 return result_type(a.begin(), b, a.size());
20150 }
20151
20152
20153
20154
20155
20156 template<typename signature_, typename traits_type_, typename r_rep_>
20157 LITE_INLINE
20158 array<signature_, traits_type_, reference_rep<b_iterator<
20159 c_iterator<typename array_signature_traits<signature_>::element_type>,
20160 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20161 minus<typename array_signature_traits<signature_>::element_type>
20162 > > >
20163 operator-(
20164 const typename array_signature_traits<signature_>::element_type& a,
20165 const array<signature_, traits_type_, r_rep_>& b)
20166 {
20167 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20168 c_iterator<typename array_signature_traits<signature_>::element_type>,
20169 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20170 minus<typename array_signature_traits<signature_>::element_type>
20171 > > > result_type;
20172
20173 return result_type(a, b.begin(), b.size());
20174 }
20175
20176
20177
20178
20179
20180
20181 template<typename signature_, typename traits_type_, typename l_rep_>
20182 LITE_INLINE
20183 array<signature_, traits_type_, reference_rep<b_iterator<
20184 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20185 c_iterator<typename array_signature_traits<signature_>::element_type>,
20186 multiplies<typename array_signature_traits<signature_>::element_type>
20187 > > >
20188 operator*(
20189 const array<signature_, traits_type_, l_rep_>& a,
20190 const typename array_signature_traits<signature_>::element_type& b)
20191 {
20192 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20193 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20194 c_iterator<typename array_signature_traits<signature_>::element_type>,
20195 multiplies<typename array_signature_traits<signature_>::element_type>
20196 > > > result_type;
20197
20198 return result_type(a.begin(), b, a.size());
20199 }
20200
20201
20202
20203
20204
20205 template<typename signature_, typename traits_type_, typename r_rep_>
20206 LITE_INLINE
20207 array<signature_, traits_type_, reference_rep<b_iterator<
20208 c_iterator<typename array_signature_traits<signature_>::element_type>,
20209 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20210 multiplies<typename array_signature_traits<signature_>::element_type>
20211 > > >
20212 operator*(
20213 const typename array_signature_traits<signature_>::element_type& a,
20214 const array<signature_, traits_type_, r_rep_>& b)
20215 {
20216 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20217 c_iterator<typename array_signature_traits<signature_>::element_type>,
20218 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20219 multiplies<typename array_signature_traits<signature_>::element_type>
20220 > > > result_type;
20221
20222 return result_type(a, b.begin(), b.size());
20223 }
20224
20225
20226
20227
20228
20229 template<typename signature_, typename traits_type_, typename l_rep_>
20230 LITE_INLINE
20231 array<signature_, traits_type_, reference_rep<b_iterator<
20232 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20233 c_iterator<typename array_signature_traits<signature_>::element_type>,
20234 divides<typename array_signature_traits<signature_>::element_type>
20235 > > >
20236 operator/(
20237 const array<signature_, traits_type_, l_rep_>& a,
20238 const typename array_signature_traits<signature_>::element_type& b)
20239 {
20240 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20241 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20242 c_iterator<typename array_signature_traits<signature_>::element_type>,
20243 divides<typename array_signature_traits<signature_>::element_type>
20244 > > > result_type;
20245
20246 return result_type(a.begin(), b, a.size());
20247 }
20248
20249
20250
20251
20252
20253
20254 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20255 LITE_INLINE
20256 array<signature_, traits_type_, reference_rep<b_iterator<
20257 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20258 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20259 plus<typename array_signature_traits<signature_>::element_type>
20260 > > >
20261 operator+(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20262 {
20263 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20264 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20265 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20266 plus<typename array_signature_traits<signature_>::element_type>
20267 > > > result_type;
20268
20269 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator+(A,A): array sizes do not match");
20270 return result_type(a.begin(), b.begin(), a.size());
20271 }
20272
20273
20274
20275
20276
20277 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20278 LITE_INLINE
20279 array<signature_, traits_type_, reference_rep<b_iterator<
20280 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20281 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20282 minus<typename array_signature_traits<signature_>::element_type>
20283 > > >
20284 operator-(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20285 {
20286 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20287 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20288 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20289 minus<typename array_signature_traits<signature_>::element_type>
20290 > > > result_type;
20291
20292 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator-(A,A): array sizes do not match");
20293 return result_type(a.begin(), b.begin(), a.size());
20294 }
20295
20296
20297
20298
20299
20300 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20301 LITE_INLINE
20302 array<signature_, traits_type_, reference_rep<b_iterator<
20303 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20304 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20305 multiplies<typename array_signature_traits<signature_>::element_type>
20306 > > >
20307 operator|(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20308 {
20309 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20310 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20311 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20312 multiplies<typename array_signature_traits<signature_>::element_type>
20313 > > > result_type;
20314
20315 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator|(A,A): array sizes do not match");
20316 return result_type(a.begin(), b.begin(), a.size());
20317 }
20318
20319
20320
20321
20322
20323 template<typename signature_, typename traits_type_, typename l_rep_>
20324 LITE_INLINE
20325 const array<signature_, traits_type_, l_rep_>&
20326 operator+=(
20327 const array<signature_, traits_type_, l_rep_>& a,
20328 const typename array_signature_traits<signature_>::element_type& b)
20329 {
20330 typedef b_iterator<
20331 typename array<signature_,traits_type_, l_rep_>::iterator,
20332 c_iterator<typename array_signature_traits<signature_>::element_type>,
20333 plus_assign<typename array_signature_traits<signature_>::element_type>
20334 > iterator_type;
20335
20336 for_each(iterator_type(a.begin(), b), a.size());
20337 return a;
20338 }
20339
20340 template<typename signature_, typename traits_type_, typename l_rep_>
20341 LITE_INLINE
20342 array<signature_, traits_type_, l_rep_>&
20343 operator+=(
20344 array<signature_, traits_type_, l_rep_>& a,
20345 const typename array_signature_traits<signature_>::element_type& b)
20346 {
20347 typedef b_iterator<
20348 typename array<signature_,traits_type_, l_rep_>::iterator,
20349 c_iterator<typename array_signature_traits<signature_>::element_type>,
20350 plus_assign<typename array_signature_traits<signature_>::element_type>
20351 > iterator_type;
20352
20353 for_each(iterator_type(a.begin(), b), a.size());
20354 return a;
20355 }
20356
20357
20358
20359
20360
20361 template<typename signature_, typename traits_type_, typename l_rep_>
20362 LITE_INLINE
20363 const array<signature_, traits_type_, l_rep_>&
20364 operator-=(
20365 const array<signature_, traits_type_, l_rep_>& a,
20366 const typename array_signature_traits<signature_>::element_type& b)
20367 {
20368 typedef b_iterator<
20369 typename array<signature_,traits_type_, l_rep_>::iterator,
20370 c_iterator<typename array_signature_traits<signature_>::element_type>,
20371 minus_assign<typename array_signature_traits<signature_>::element_type>
20372 > iterator_type;
20373
20374 for_each(iterator_type(a.begin(), b), a.size());
20375 return a;
20376 }
20377
20378 template<typename signature_, typename traits_type_, typename l_rep_>
20379 LITE_INLINE
20380 array<signature_, traits_type_, l_rep_>&
20381 operator-=(
20382 array<signature_, traits_type_, l_rep_>& a,
20383 const typename array_signature_traits<signature_>::element_type& b)
20384 {
20385 typedef b_iterator<
20386 typename array<signature_,traits_type_, l_rep_>::iterator,
20387 c_iterator<typename array_signature_traits<signature_>::element_type>,
20388 minus_assign<typename array_signature_traits<signature_>::element_type>
20389 > iterator_type;
20390
20391 for_each(iterator_type(a.begin(), b), a.size());
20392 return a;
20393 }
20394
20395
20396
20397
20398
20399 template<typename signature_, typename traits_type_, typename l_rep_>
20400 LITE_INLINE
20401 const array<signature_, traits_type_, l_rep_>&
20402 operator*=(
20403 const array<signature_, traits_type_, l_rep_>& a,
20404 const typename array_signature_traits<signature_>::element_type& b)
20405 {
20406 typedef b_iterator<
20407 typename array<signature_,traits_type_, l_rep_>::iterator,
20408 c_iterator<typename array_signature_traits<signature_>::element_type>,
20409 multiplies_assign<typename array_signature_traits<signature_>::element_type>
20410 > iterator_type;
20411
20412 for_each(iterator_type(a.begin(), b), a.size());
20413 return a;
20414 }
20415
20416 template<typename signature_, typename traits_type_, typename l_rep_>
20417 LITE_INLINE
20418 array<signature_, traits_type_, l_rep_>&
20419 operator*=(
20420 array<signature_, traits_type_, l_rep_>& a,
20421 const typename array_signature_traits<signature_>::element_type& b)
20422 {
20423 typedef b_iterator<
20424 typename array<signature_,traits_type_, l_rep_>::iterator,
20425 c_iterator<typename array_signature_traits<signature_>::element_type>,
20426 multiplies_assign<typename array_signature_traits<signature_>::element_type>
20427 > iterator_type;
20428
20429 for_each(iterator_type(a.begin(), b), a.size());
20430 return a;
20431 }
20432
20433
20434
20435
20436
20437 template<typename signature_, typename traits_type_, typename l_rep_>
20438 LITE_INLINE
20439 const array<signature_, traits_type_, l_rep_>&
20440 operator/=(
20441 const array<signature_, traits_type_, l_rep_>& a,
20442 const typename array_signature_traits<signature_>::element_type& b)
20443 {
20444 typedef b_iterator<
20445 typename array<signature_,traits_type_, l_rep_>::iterator,
20446 c_iterator<typename array_signature_traits<signature_>::element_type>,
20447 divides_assign<typename array_signature_traits<signature_>::element_type>
20448 > iterator_type;
20449
20450 for_each(iterator_type(a.begin(), b), a.size());
20451 return a;
20452 }
20453
20454 template<typename signature_, typename traits_type_, typename l_rep_>
20455 LITE_INLINE
20456 array<signature_, traits_type_, l_rep_>&
20457 operator/=(
20458 array<signature_, traits_type_, l_rep_>& a,
20459 const typename array_signature_traits<signature_>::element_type& b)
20460 {
20461 typedef b_iterator<
20462 typename array<signature_,traits_type_, l_rep_>::iterator,
20463 c_iterator<typename array_signature_traits<signature_>::element_type>,
20464 divides_assign<typename array_signature_traits<signature_>::element_type>
20465 > iterator_type;
20466
20467 for_each(iterator_type(a.begin(), b), a.size());
20468 return a;
20469 }
20470
20471
20472
20473
20474
20475 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20476 LITE_INLINE
20477 array<signature_, traits_type_, l_rep_>&
20478 operator+=(array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20479 {
20480 typedef b_iterator<
20481 typename array<signature_,traits_type_, l_rep_>::iterator,
20482 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20483 plus_assign<typename array_signature_traits<signature_>::element_type>
20484 > iterator_type;
20485
20486 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator+=(A,A): array sizes do not match");
20487 for_each(iterator_type(a.begin(), b.begin()), a.size());
20488 return a;
20489 }
20490
20491 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20492 LITE_INLINE
20493 const array<signature_, traits_type_, l_rep_>&
20494 operator+=(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20495 {
20496 typedef b_iterator<
20497 typename array<signature_,traits_type_, l_rep_>::iterator,
20498 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20499 plus_assign<typename array_signature_traits<signature_>::element_type>
20500 > iterator_type;
20501
20502 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator+=(A,A): array sizes do not match");
20503 for_each(iterator_type(a.begin(), b.begin()), a.size());
20504 return a;
20505 }
20506
20507
20508
20509
20510
20511 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20512 LITE_INLINE
20513 array<signature_, traits_type_, l_rep_>&
20514 operator-=(array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20515 {
20516 typedef b_iterator<
20517 typename array<signature_,traits_type_, l_rep_>::iterator,
20518 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20519 minus_assign<typename array_signature_traits<signature_>::element_type>
20520 > iterator_type;
20521
20522 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator-=(A,A): array sizes do not match");
20523 for_each(iterator_type(a.begin(), b.begin()), a.size());
20524 return a;
20525 }
20526
20527 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20528 LITE_INLINE
20529 const array<signature_, traits_type_, l_rep_>&
20530 operator-=(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20531 {
20532 typedef b_iterator<
20533 typename array<signature_,traits_type_, l_rep_>::iterator,
20534 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20535 minus_assign<typename array_signature_traits<signature_>::element_type>
20536 > iterator_type;
20537
20538 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator-=(A,A): array sizes do not match");
20539 for_each(iterator_type(a.begin(), b.begin()), a.size());
20540 return a;
20541 }
20542
20543
20544
20545
20546
20547 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20548 LITE_INLINE
20549 array<signature_, traits_type_, l_rep_>&
20550 operator|=(array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20551 {
20552 typedef b_iterator<
20553 typename array<signature_,traits_type_, l_rep_>::iterator,
20554 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20555 multiplies_assign<typename array_signature_traits<signature_>::element_type>
20556 > iterator_type;
20557
20558 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator|=(A,A): array sizes do not match");
20559 for_each(iterator_type(a.begin(), b.begin()), a.size());
20560 return a;
20561 }
20562
20563 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20564 LITE_INLINE
20565 const array<signature_, traits_type_, l_rep_>&
20566 operator|=(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20567 {
20568 typedef b_iterator<
20569 typename array<signature_,traits_type_, l_rep_>::iterator,
20570 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20571 multiplies_assign<typename array_signature_traits<signature_>::element_type>
20572 > iterator_type;
20573
20574 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator|=(A,A): array sizes do not match");
20575 for_each(iterator_type(a.begin(), b.begin()), a.size());
20576 return a;
20577 }
20578
20579
20580
20581
20582
20583 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20584 LITE_INLINE bool
20585 operator<(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20586 {
20587 typedef b_iterator<
20588 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20589 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20590 less<typename array_signature_traits<signature_>::element_type>
20591 > iterator_type;
20592
20593 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator<(A,A): array sizes do not match");
20594 return for_each_c(iterator_type(a.begin(), b.begin()), a.size());
20595 }
20596
20597
20598
20599
20600
20601 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20602 LITE_INLINE bool
20603 operator<=(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20604 {
20605 typedef b_iterator<
20606 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20607 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20608 less_equal<typename array_signature_traits<signature_>::element_type>
20609 > iterator_type;
20610
20611 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator<=(A,A): array sizes do not match");
20612 return for_each_c(iterator_type(a.begin(), b.begin()), a.size());
20613 }
20614
20615
20616
20617
20618
20619 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20620 LITE_INLINE bool
20621 operator==(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20622 {
20623 typedef b_iterator<
20624 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20625 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20626 equal_to<typename array_signature_traits<signature_>::element_type>
20627 > iterator_type;
20628
20629 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator==(A,A): array sizes do not match");
20630 return for_each_c(iterator_type(a.begin(), b.begin()), a.size());
20631 }
20632
20633
20634
20635
20636
20637 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20638 LITE_INLINE bool
20639 operator!=(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20640 {
20641 return !(a==b);
20642 }
20643
20644
20645
20646
20647
20648 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20649 LITE_INLINE bool
20650 operator>=(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20651 {
20652 typedef b_iterator<
20653 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20654 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20655 greater_equal<typename array_signature_traits<signature_>::element_type>
20656 > iterator_type;
20657
20658 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator>=(A,A): array sizes do not match");
20659 return for_each_c(iterator_type(a.begin(), b.begin()), a.size());
20660 }
20661
20662
20663
20664
20665
20666 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20667 LITE_INLINE bool
20668 operator>(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20669 {
20670 typedef b_iterator<
20671 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20672 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20673 greater<typename array_signature_traits<signature_>::element_type>
20674 > iterator_type;
20675
20676 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator>(A,A): array sizes do not match");
20677 return for_each_c(iterator_type(a.begin(), b.begin()), a.size());
20678 }
20679
20680
20681
20682
20683
20684 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20685 LITE_INLINE int
20686 compare(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20687 {
20688 typedef b_iterator<
20689 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20690 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20691 compare3<typename array_signature_traits<signature_>::element_type>
20692 > iterator_type;
20693
20694 while_equal<typename compare3<
20695 typename array_signature_traits<signature_>::element_type>::result_type> func;
20696
20697 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "compare(A,A): array sizes do not match");
20698 for_each_c(iterator_type(a.begin(), b.begin()), func, a.size());
20699 return func();
20700 }
20701
20702
20703
20704
20705
20706 template<typename signature_, typename traits_type_, typename rep_>
20707 LITE_INLINE typename array_signature_traits<signature_>::element_type
20708 norm(const array<signature_, traits_type_, rep_>& a)
20709 {
20710 typedef u_iterator<
20711 typename array<signature_,traits_type_, rep_>::const_iterator,
20712 square<typename array_signature_traits<signature_>::element_type>
20713 > iterator_type;
20714
20715 accumulator<typename array_signature_traits<signature_>::element_type> acc;
20716
20717 for_each(iterator_type(a.begin()), acc, a.size());
20718 return acc();
20719 }
20720
20721
20722
20723
20724
20725 template<typename signature_, typename traits_type_, typename rep_>
20726 LITE_INLINE const typename array_helper<signature_, traits_type_>::temporary_array
20727 normalized(const array<signature_, traits_type_, rep_>& a)
20728 {
20729 typedef array<signature_, traits_type_, rep_> a_type;
20730 typedef typename array_helper<signature_, traits_type_>::temporary_array result_type;
20731 typedef typename array_signature_traits<signature_>::element_type value_type;
20732 typedef u_iterator<typename result_type::iterator, square<value_type> > iterator_type;
20733
20734 result_type result = a;
20735 accumulator<value_type> acc;
20736
20737 for_each(iterator_type(result.begin()), acc, result.size());
20738 result *= value_type(1)/sqrt(acc());
20739 return result;
20740 }
20741
20742
20743
20744
20745
20746 template<typename signature_, typename traits_type_, typename rep_>
20747 LITE_INLINE typename array_signature_traits<signature_>::element_type
20748 abs(const array<signature_, traits_type_, rep_>& a)
20749 {
20750 return sqrt(norm(a));
20751 }
20752
20753
20754
20755
20756
20757 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20758 LITE_INLINE
20759 array<signature_, traits_type_, reference_rep<b_iterator<
20760 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20761 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20762 minimum<typename array_signature_traits<signature_>::element_type>
20763 > > >
20764 min(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20765 {
20766 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20767 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20768 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20769 minimum<typename array_signature_traits<signature_>::element_type>
20770 > > > result_type;
20771
20772 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "min(A,A): array sizes do not match");
20773
20774 return result_type(a.begin(), b.begin(), a.size());
20775 }
20776
20777 template<typename signature_, typename traits_type_, typename rep_>
20778 LITE_INLINE
20779 array<signature_, traits_type_, reference_rep<b_iterator<
20780 typename array<signature_,traits_type_, rep_>::const_iterator,
20781 typename array<signature_,traits_type_, rep_>::const_iterator,
20782 minimum<typename array_signature_traits<signature_>::element_type>
20783 > > >
20784 min(const array<signature_, traits_type_, rep_>& a, const array<signature_, traits_type_, rep_>& b)
20785 {
20786 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20787 typename array<signature_,traits_type_, rep_>::const_iterator,
20788 typename array<signature_,traits_type_, rep_>::const_iterator,
20789 minimum<typename array_signature_traits<signature_>::element_type>
20790 > > > result_type;
20791
20792 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "min(A,A): array sizes do not match");
20793
20794 return result_type(a.begin(), b.begin(), a.size());
20795 }
20796
20797
20798
20799
20800
20801 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
20802 LITE_INLINE
20803 array<signature_, traits_type_, reference_rep<b_iterator<
20804 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20805 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20806 maximum<typename array_signature_traits<signature_>::element_type>
20807 > > >
20808 max(const array<signature_, traits_type_, l_rep_>& a, const array<signature_, traits_type_, r_rep_>& b)
20809 {
20810 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20811 typename array<signature_,traits_type_, l_rep_>::const_iterator,
20812 typename array<signature_,traits_type_, r_rep_>::const_iterator,
20813 maximum<typename array_signature_traits<signature_>::element_type>
20814 > > > result_type;
20815
20816 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "max(A,A): array sizes do not match");
20817
20818 return result_type(a.begin(), b.begin(), a.size());
20819 }
20820
20821 template<typename signature_, typename traits_type_, typename rep_>
20822 LITE_INLINE
20823 array<signature_, traits_type_, reference_rep<b_iterator<
20824 typename array<signature_,traits_type_, rep_>::const_iterator,
20825 typename array<signature_,traits_type_, rep_>::const_iterator,
20826 maximum<typename array_signature_traits<signature_>::element_type>
20827 > > >
20828 max(const array<signature_, traits_type_, rep_>& a, const array<signature_, traits_type_, rep_>& b)
20829 {
20830 typedef array<signature_, traits_type_, reference_rep<b_iterator<
20831 typename array<signature_,traits_type_, rep_>::const_iterator,
20832 typename array<signature_,traits_type_, rep_>::const_iterator,
20833 maximum<typename array_signature_traits<signature_>::element_type>
20834 > > > result_type;
20835
20836 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "max(A,A): array sizes do not match");
20837
20838 return result_type(a.begin(), b.begin(), a.size());
20839 }
20840
20841
20842
20843
20844
20845 template<typename value_type_, int n_, typename traits_type_, typename l_rep_, typename r_rep_>
20846 LITE_INLINE
20847 typename detail::enable_if<(array_signature_traits<value_type_>::dimensions == 0), value_type_>::type
20848 operator*(
20849 const array<value_type_[n_], traits_type_, l_rep_>& a,
20850 const array<value_type_[n_], traits_type_, r_rep_>& b)
20851 {
20852 typedef b_iterator<
20853 typename array<value_type_[n_],traits_type_, l_rep_>::const_iterator,
20854 typename array<value_type_[n_],traits_type_, r_rep_>::const_iterator,
20855 multiplies<value_type_>
20856 > iterator_type;
20857
20858 accumulator<value_type_> acc;
20859
20860 LITE_ARRAY_SIZE_CHECK(a.size(), b.size(), "operator*(V,V): vector sizes do not match");
20861 for_each(iterator_type(a.begin(), b.begin()), acc, a.size());
20862 return acc();
20863 }
20864
20865
20866
20867
20868
20869 template<typename value_type_, int m_, int n_, typename traits_type_, typename l_rep_, typename r_rep_>
20870 LITE_INLINE
20871 typename detail::enable_if<
20872 (array_signature_traits<value_type_>::dimensions == 0),
20873 const typename array_helper<value_type_[m_], traits_type_>::temporary_array
20874 >::type
20875 operator*(
20876 const array<value_type_[m_][n_], traits_type_, l_rep_>& a,
20877 const array<value_type_[n_], traits_type_, r_rep_>& b)
20878 {
20879 typedef array<value_type_[m_][n_], traits_type_, l_rep_> a_type;
20880 typedef array<value_type_[n_], traits_type_, r_rep_> b_type;
20881 typedef typename array_helper<value_type_[m_], traits_type_>::temporary_array result_type;
20882 typedef typename result_type::size_type size_type;
20883
20884 typename detail::matrix_policy<a_type, 1> ::cached_fwd_array aa = a;
20885 typename detail::matrix_policy<b_type, 9> ::cached_array bb = b;
20886
20887 const int m = aa.size().i0;
20888
20889 const size_type size(m);
20890 result_type result(size);
20891
20892 LITE_ARRAY_SIZE_CHECK(aa.size().i1, b.size().i0, "operator*(M,V): matrix/vector sizes do not match");
20893
20894 for (int i=0; i<m; i++)
20895 result[i] = aa[row(i)]*bb;
20896
20897 return result;
20898 }
20899
20900
20901
20902
20903
20904 template<typename value_type_, int m_, int n_, typename traits_type_, typename l_rep_, typename r_rep_>
20905 LITE_INLINE
20906 typename detail::enable_if<
20907 (array_signature_traits<value_type_>::dimensions == 0),
20908 const typename array_helper<value_type_[n_], traits_type_>::temporary_array
20909 >::type
20910 operator*(
20911 const array<value_type_[m_], traits_type_, l_rep_>& a,
20912 const array<value_type_[m_][n_], traits_type_, r_rep_>& b)
20913 {
20914 typedef array<value_type_[m_], traits_type_, l_rep_> a_type;
20915 typedef array<value_type_[m_][n_], traits_type_, r_rep_> b_type;
20916 typedef typename array_helper<value_type_[n_], traits_type_>::temporary_array result_type;
20917 typedef typename result_type::size_type size_type;
20918
20919 typename detail::matrix_policy<a_type, 9>::cached_array aa = a;
20920 typename detail::matrix_policy<b_type, 1>::cached_rev_array bb = b;
20921
20922 const int n = bb.size().i1;
20923
20924 const size_type size(n);
20925 result_type result(size);
20926
20927 LITE_ARRAY_SIZE_CHECK(aa.size().i0, bb.size().i0, "operator*(V,M): matrix/vector sizes do not match");
20928
20929 for (int j=0; j<n; j++)
20930 result[j] = aa*bb[column(j)];
20931
20932 return result;
20933 }
20934
20935
20936
20937
20938
20939 template<
20940 typename value_type_,
20941 int m_,
20942 int n_,
20943 int p_,
20944 typename traits_type_,
20945 typename l_rep_,
20946 typename r_rep_>
20947 LITE_INLINE
20948 typename detail::enable_if<
20949 (array_signature_traits<value_type_>::dimensions == 0),
20950 const typename array_helper<value_type_[m_][p_], traits_type_>::temporary_array
20951 >::type
20952 operator*(
20953 const array<value_type_[m_][n_], traits_type_, l_rep_>& a,
20954 const array<value_type_[n_][p_], traits_type_, r_rep_>& b)
20955 {
20956 typedef array<value_type_[m_][n_], traits_type_, l_rep_> a_type;
20957 typedef array<value_type_[n_][p_], traits_type_, r_rep_> b_type;
20958 typedef typename array_helper<value_type_[m_][p_], traits_type_>::temporary_array result_type;
20959 typedef typename result_type::size_type size_type;
20960
20961 typename detail::matrix_policy<a_type, 9>::cached_fwd_array aa = a;
20962 typename detail::matrix_policy<b_type, 9>::cached_rev_array bb = b;
20963
20964 const int m = aa.size().i0;
20965 const int p = bb.size().i1;
20966
20967 const size_type size(m, p);
20968 result_type result(size);
20969
20970 LITE_ARRAY_SIZE_CHECK(aa.size().i1, bb.size().i0, "operator*(M,M): matrix sizes do not match");
20971
20972 for (int i=0; i<m; i++)
20973 for (int j=0; j<p; j++)
20974 result(i,j) = aa[row(i)]*bb[column(j)];
20975
20976 return result;
20977 }
20978
20979
20980
20981
20982
20983 template<typename value_type_, typename traits_type_, typename l_rep_, typename r_rep_>
20984 LITE_INLINE
20985 typename detail::enable_if<(
20986 array_signature_traits<value_type_>::dimensions == 0),
20987 value_type_
20988 >::type
20989 operator%(
20990 const array<value_type_[2], traits_type_, l_rep_>& a,
20991 const array<value_type_[2], traits_type_, r_rep_>& b)
20992 {
20993 return a[0]*b[1]-a[1]*b[0];
20994 }
20995
20996
20997
20998
20999
21000 template<typename value_type_, typename traits_type_, typename l_rep_, typename r_rep_>
21001 LITE_INLINE
21002 typename detail::enable_if<(
21003 array_signature_traits<value_type_>::dimensions == 0),
21004 const typename array_helper<value_type_[3], traits_type_>::temporary_array
21005 >::type
21006 operator%(
21007 const array<value_type_[3], traits_type_, l_rep_>& a,
21008 const array<value_type_[3], traits_type_, r_rep_>& b)
21009 {
21010 typedef array<value_type_[3], traits_type_, l_rep_> a_type;
21011 typedef array<value_type_[3], traits_type_, r_rep_> b_type;
21012 typedef typename array_helper<value_type_[3], traits_type_>::temporary_array result_type;
21013
21014 typename detail::matrix_policy<a_type, 9>::cached_array aa = a;
21015 typename detail::matrix_policy<b_type, 9>::cached_array bb = b;
21016
21017 return result_type(aa[1]*bb[2]-aa[2]*bb[1], aa[2]*bb[0]-aa[0]*bb[2], aa[0]*bb[1]-aa[1]*bb[0]);
21018 }
21019
21020
21021
21022
21023
21024 template<typename value_type_, typename traits_type_, typename rep_>
21025 LITE_INLINE
21026 typename detail::enable_if<(
21027 array_signature_traits<value_type_>::dimensions == 0),
21028 value_type_
21029 >::type
21030 det(const array<value_type_[2][2], traits_type_, rep_>& a)
21031 {
21032 return a(0, 0)*a(1, 1) - a(0, 1)*a(1, 0);
21033 }
21034
21035
21036
21037
21038
21039 template<typename value_type_, typename traits_type_, typename rep_>
21040 LITE_INLINE
21041 typename detail::enable_if<(
21042 array_signature_traits<value_type_>::dimensions == 0),
21043 value_type_
21044 >::type
21045 det(const array<value_type_[3][3], traits_type_, rep_>& a)
21046 {
21047 typedef array<value_type_[3][3], traits_type_, rep_> a_type;
21048 typename detail::matrix_policy<a_type, 9>::cached_fwd_array aa = a;
21049
21050 value_type_ det00 = aa(2, 2)*aa(1, 1)-aa(2, 1)*aa(1, 2);
21051 value_type_ det10 = aa(2, 2)*aa(0, 1)-aa(2, 1)*aa(0, 2);
21052 value_type_ det20 = aa(1, 2)*aa(0, 1)-aa(1, 1)*aa(0, 2);
21053 return aa(0, 0)*det00-aa(1, 0)*det10+aa(2, 0)*det20;
21054 }
21055
21056
21057
21058
21059
21060
21061 template<typename value_type_, int n_, typename traits_type_, typename rep_>
21062 LITE_INLINE
21063 typename detail::enable_if<(
21064 array_signature_traits<value_type_>::dimensions == 0),
21065 value_type_
21066 >::type
21067 det(const array<value_type_[n_][n_], traits_type_, rep_>& a)
21068 {
21069 using std::abs;
21070
21071 typedef typename array_helper<value_type_[n_][n_], traits_type_>::fwd_temporary_array temporary_type;
21072 typedef array<value_type_[n_][n_], traits_type_, rep_> a_type;
21073
21074 LITE_ARRAY_SIZE_CHECK(a.size().i0, a.size().i1, "det(M): not a square matrix");
21075
21076 temporary_type aa = a;
21077 const int n = aa.size().i0;
21078 int swaps = 0;
21079
21080 for (int i=0; i<n; i++) {
21081 const block<0,1> blk(0, n-i);
21082 int i_max = i;
21083 value_type_ val_max = abs(aa(i, i));
21084
21085
21086 for (int i2 = i+1; i2<n; i2++)
21087 if (abs(aa(i2, i)) > val_max) {
21088 i_max = i2;
21089 val_max = abs(aa(i2, i));
21090 }
21091
21092
21093 if (i_max != i) {
21094 typename transform_traits<temporary_type, block<0,1> >::temporary_array tmp_row;
21095
21096 tmp_row = aa[blk(i, i)];
21097 aa[blk(i, i)] = aa[blk(i_max, i)];
21098 aa[blk(i_max, i)] = tmp_row;
21099 swaps++;
21100 }
21101
21102
21103 if (aa(i, i) == value_type_())
21104 return value_type_();
21105
21106 value_type_ epsilon = std::numeric_limits<value_type_>::epsilon()*aa(i, i)*n;
21107 value_type_ factor = value_type_(1)/aa(i, i);
21108
21109
21110 for (int i2 = i+1; i2<n; i2++)
21111 if (abs(aa(i2, i)) > epsilon)
21112 aa[blk(i2, i)] -= (aa(i2, i)*factor)*aa[blk(i, i)];
21113 }
21114
21115 value_type_ result = value_type_(1);
21116
21117 for (int i=0; i<n; i++)
21118 result *= aa(i, i);
21119
21120 return (swaps & 1) != 0 ? -result : result;
21121 }
21122
21123
21124
21125
21126
21127 template<typename value_type_, typename traits_type_, typename rep_>
21128 LITE_INLINE
21129 typename detail::enable_if<(
21130 array_signature_traits<value_type_>::dimensions == 0),
21131 const typename array_helper<value_type_[2][2], traits_type_>::temporary_array
21132 >::type
21133 inverse(const array<value_type_[2][2], traits_type_, rep_>& a)
21134 {
21135 typedef array<value_type_[2][2], traits_type_, rep_> a_type;
21136 typename detail::matrix_policy<a_type, 9>::cached_fwd_array aa = a;
21137
21138 typename array_helper<value_type_[2][2], traits_type_>::temporary_array result;
21139
21140 value_type_ inv_det = value_type_(1)/(aa(0, 0)*aa(1, 1) - aa(0, 1)*a(1, 0));
21141
21142 result(0, 0) = aa(1, 1) * inv_det;
21143 result(0, 1) = -aa(0, 1) * inv_det;
21144 result(0, 2) = -aa(1, 0) * inv_det;
21145 result(0, 3) = aa(0, 0) * inv_det;
21146
21147 return result;
21148 }
21149
21150
21151
21152
21153
21154 template<typename value_type_, typename traits_type_, typename rep_>
21155 LITE_INLINE
21156 typename detail::enable_if<(
21157 array_signature_traits<value_type_>::dimensions == 0),
21158 const typename array_helper<value_type_[3][3], traits_type_>::temporary_array
21159 >::type
21160 inverse(const array<value_type_[3][3], traits_type_, rep_>& a)
21161 {
21162 typedef array<value_type_[3][3], traits_type_, rep_> a_type;
21163 typename detail::matrix_policy<a_type, 9>::cached_fwd_array aa = a;
21164
21165 typename array_helper<value_type_[3][3], traits_type_>::temporary_array result;
21166
21167 value_type_ det00 = aa(2, 2)*aa(1, 1)-aa(2, 1)*aa(1, 2);
21168 value_type_ det10 = aa(2, 2)*aa(0, 1)-aa(2, 1)*aa(0, 2);
21169 value_type_ det20 = aa(1, 2)*aa(0, 1)-aa(1, 1)*aa(0, 2);
21170 value_type_ inv_det = value_type_(1)/(aa(0, 0)*det00-aa(1, 0)*det10+aa(2, 0)*det20);
21171
21172 result(0, 0) = det00*inv_det;
21173 result(0, 1) = -det10*inv_det;
21174 result(0, 2) = det20*inv_det;
21175 result(1, 0) = (aa(2, 0)*aa(1, 2)-aa(2, 2)*aa(1, 0))*inv_det;
21176 result(1, 1) = (aa(2, 2)*aa(0, 0)-aa(2, 0)*aa(0, 2))*inv_det;
21177 result(1, 2) = (aa(1, 0)*aa(0, 2)-aa(1, 2)*aa(0, 0))*inv_det;
21178 result(2, 0) = (aa(2, 1)*aa(1, 0)-aa(2, 0)*aa(1, 1))*inv_det;
21179 result(2, 1) = (aa(2, 0)*aa(0, 1)-aa(2, 1)*aa(0, 0))*inv_det;
21180 result(2, 2) = (aa(1, 1)*aa(0, 0)-aa(1, 0)*aa(0, 1))*inv_det;
21181
21182 return result;
21183 }
21184
21185
21186
21187
21188
21189
21190 template<typename value_type_, int n_, typename traits_type_, typename rep_>
21191 LITE_INLINE
21192 typename detail::enable_if<(
21193 array_signature_traits<value_type_>::dimensions == 0),
21194 const typename array_helper<value_type_[n_][n_], traits_type_>::temporary_array
21195 >::type
21196 inverse(const array<value_type_[n_][n_], traits_type_, rep_>& a)
21197 {
21198 using std::abs;
21199
21200 typedef array<value_type_[n_][n_], traits_type_, rep_> a_type;
21201 typedef typename array_helper<value_type_[n_][n_], traits_type_>::temporary_array temporary_type;
21202
21203 LITE_ARRAY_SIZE_CHECK(a.size().i0, a.size().i1, "inverse(M): not a square matrix");
21204
21205 const int n = a.size().i0;
21206 temporary_type aa=a, result(n, n);
21207
21208 result = value_type_();
21209
21210 result[diagonal()] = value_type_(1);
21211
21212 for (int i=0; i<n; i++) {
21213 const block<0,1> blk(0, n-i);
21214 int i_max = i;
21215 value_type_ val_max = abs(aa(i, i));
21216
21217
21218 for (int i2 = i+1; i2<n; i2++)
21219 if (abs(aa(i2, i)) > val_max) {
21220 i_max = i2;
21221 val_max = abs(aa(i2, i));
21222 }
21223
21224
21225 if (i_max != i) {
21226 typename transform_traits<temporary_type, row>::temporary_array res_tmp;
21227
21228 res_tmp = result[row(i)];
21229 result[row(i)] = result[row(i_max)];
21230 result[row(i_max)] = res_tmp;
21231
21232 typename transform_traits<temporary_type, block<0,1> >::temporary_array org_tmp;
21233
21234 org_tmp = aa[blk(i,i)];
21235 aa[blk(i,i)] = aa[blk(i_max, i)];
21236 aa[blk(i_max,i)] = org_tmp;
21237 }
21238
21239
21240 if (aa(i, i) == value_type_()) {
21241 result = value_type_();
21242 break;
21243 }
21244
21245
21246 value_type_ factor = value_type_(1)/aa(i, i);
21247
21248 result[row(i)] *= factor;
21249 aa[blk(i, i)] *= factor;
21250
21251 value_type_ epsilon = std::numeric_limits<value_type_>::epsilon()*aa(i, i)*n;
21252
21253
21254 for (int i2 = i+1; i2<n; i2++)
21255 if (abs(aa(i2, i)) > epsilon) {
21256 result[row(i2)] -= aa(i2, i)*result[row(i)];
21257 aa[blk(i2,i)] -= aa(i2, i)*aa[blk(i,i)];
21258 }
21259 }
21260
21261
21262 for (int i = n-1; i>=0; i--) {
21263 value_type_ epsilon = std::numeric_limits<value_type_>::epsilon()*aa(i, i)*n;
21264
21265 for (int i2 = 0; i2<i; i2++)
21266 if (abs(aa(i2, i)) > epsilon)
21267
21268 result[row(i2)] -= aa(i2, i)*result[row(i)];
21269 }
21270
21271 return result;
21272 }
21273
21274
21275
21276
21277
21278 template<typename value_type_, typename traits_type_, typename rep_>
21279 LITE_INLINE
21280 typename detail::enable_if<(
21281 array_signature_traits<value_type_>::dimensions == 0),
21282 const typename array_helper<value_type_[2][2], traits_type_>::temporary_array
21283 >::type
21284 rotation_n(
21285 const array<value_type_[2], traits_type_, rep_>&,
21286 const typename array_signature_traits<value_type_>::element_type& angle)
21287 {
21288 using namespace std;
21289 typename array_helper<value_type_[2][2], traits_type_>::temporary_array result;
21290
21291 value_type_ tmp_cos = cos(angle);
21292 value_type_ tmp_sin = sin(angle);
21293
21294 result(0, 0) = tmp_cos;
21295 result(1, 1) = tmp_cos;
21296 result(0, 1) = -tmp_sin;
21297 result(1, 0) = tmp_sin;
21298
21299 return result;
21300 }
21301
21302 template<typename value_type_, typename traits_type_, typename rep_>
21303 LITE_INLINE
21304 typename detail::enable_if<(
21305 array_signature_traits<value_type_>::dimensions == 0),
21306 const typename array_helper<value_type_[2][2], traits_type_>::temporary_array
21307 >::type
21308 rotation(
21309 const array<value_type_[2], traits_type_, rep_>& dummy,
21310 const typename array_signature_traits<value_type_>::element_type& angle)
21311 {
21312 return rotation_n(dummy, angle);
21313 }
21314
21315
21316
21317
21318
21319 template<typename value_type_, typename traits_type_, typename rep_>
21320 LITE_INLINE
21321 typename detail::enable_if<(
21322 array_signature_traits<value_type_>::dimensions == 0),
21323 const typename array_helper<value_type_[3][3], traits_type_>::temporary_array
21324 >::type
21325 rotation_n(
21326 const array<value_type_[3], traits_type_, rep_>& axis,
21327 const typename array_signature_traits<value_type_>::element_type& angle)
21328 {
21329 using namespace std;
21330
21331 typedef array<value_type_[3], traits_type_, rep_> axis_type;
21332
21333 typename detail::matrix_policy<axis_type, 9> ::cached_array cached_axis = axis;
21334 typename array_helper<value_type_[3][3], traits_type_>::temporary_array result;
21335
21336 value_type_ tmp_cos = cos(angle);
21337 value_type_ tmp_sin = sin(angle);
21338 value_type_ tmp_rcos = value_type_(1) - tmp_cos;
21339
21340 result(0, 0) = tmp_cos + cached_axis[0]*cached_axis[0]*tmp_rcos;
21341 result(1, 1) = tmp_cos + cached_axis[1]*cached_axis[1]*tmp_rcos;
21342 result(2, 2) = tmp_cos + cached_axis[2]*cached_axis[2]*tmp_rcos;
21343
21344 value_type_ tmp1 = cached_axis[0]*cached_axis[1]*tmp_rcos;
21345 value_type_ tmp2 = cached_axis[2]*tmp_sin;
21346
21347 result(1, 0) = tmp1 + tmp2;
21348 result(0, 1) = tmp1 - tmp2;
21349 tmp1 = cached_axis[0]*cached_axis[2]*tmp_rcos;
21350 tmp2 = cached_axis[1]*tmp_sin;
21351 result(2, 0) = tmp1 - tmp2;
21352 result(0, 2) = tmp1 + tmp2;
21353 tmp1 = cached_axis[1]*cached_axis[2]*tmp_rcos;
21354 tmp2 = cached_axis[0]*tmp_sin;
21355 result(2, 1) = tmp1 + tmp2;
21356 result(1, 2) = tmp1 - tmp2;
21357
21358 return result;
21359 }
21360
21361 template<typename value_type_, typename traits_type_, typename rep_>
21362 LITE_INLINE
21363 typename detail::enable_if<(
21364 array_signature_traits<value_type_>::dimensions == 0),
21365 const typename array_helper<value_type_[3][3], traits_type_>::temporary_array
21366 >::type
21367 rotation(
21368 const array<value_type_[3], traits_type_, rep_>& axis,
21369 const typename array_signature_traits<value_type_>::element_type& angle)
21370 {
21371 typename array_helper<value_type_[3], traits_type_>::temporary_array normalized_axis = axis;
21372
21373 normalized_axis *= value_type_(1)/abs(normalized_axis);
21374
21375 return rotation_n(normalized_axis, angle);
21376 }
21377
21378
21379
21380
21381
21382 template<typename value_type_, int n_, typename traits_type_, typename rep_>
21383 LITE_INLINE
21384 typename detail::enable_if<(
21385 array_signature_traits<value_type_>::dimensions == 0),
21386 const typename array_helper<value_type_[n_][n_], traits_type_>::temporary_array
21387 >::type
21388 scale(const array<value_type_[n_], traits_type_, rep_>& factors)
21389 {
21390 const int n = factors.size().i0;
21391 typename array_helper<value_type_[n_][n_], traits_type_>::temporary_array
21392 result(n, n);
21393
21394 result = value_type_();
21395 result[diagonal()] = factors;
21396 return result;
21397 }
21398
21399
21400
21401
21402
21420 class array_comparator
21421 {
21422 public:
21423 LITE_INLINE array_comparator() {}
21424
21425 LITE_INLINE array_comparator(const array_comparator&) {}
21426
21427 LITE_INLINE array_comparator& operator= (array_comparator&) { return *this; }
21428
21430 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
21431 LITE_INLINE bool
21432 operator()(
21433 const array<signature_, traits_type_, l_rep_>& a,
21434 const array<signature_, traits_type_, r_rep_>& b) const
21435 {
21436 return compare(a, b) < 0;
21437 }
21438 };
21439
21440
21441
21442
21443
21444 #ifdef DOCUMENTATION_ONLY
21445
21461 template<typename value_type_, int n0_ ..., int nN_>
21462 const array<...>
21463 from(value_type_ (&a)[n0_]...[nN_]);
21464
21465 #else // DOCUMENTATION_ONLY
21466
21467 template<
21468 typename value_type_,
21469 int n0_
21470 >
21471 LITE_INLINE
21472 typename detail::enable_if<
21473 array_signature_traits<value_type_[n0_]>::is_fixed_size,
21474 const array<typename array_signature_traits<value_type_[n0_]>::signature,
21475 default_array_traits,
21476 reference_rep<typename array_signature_traits<value_type_[n0_]>::default_iterator> >
21477 >::type
21478 from(value_type_ (&a)[n0_])
21479 {
21480 typedef array<typename array_signature_traits<value_type_[n0_]>::signature,
21481 default_array_traits,
21482 reference_rep<typename array_signature_traits<value_type_[n0_]>::default_iterator>
21483 > result_type;
21484
21485 return result_type(&a[0], typename result_type::size_type());
21486 };
21487
21488 template<
21489 typename value_type_,
21490 int n0_,
21491 int n1_
21492 >
21493 LITE_INLINE
21494 typename detail::enable_if<
21495 array_signature_traits<value_type_[n0_][n1_]>::is_fixed_size,
21496 const array<typename array_signature_traits<value_type_[n0_][n1_]>::signature,
21497 default_array_traits,
21498 reference_rep<typename array_signature_traits<value_type_[n0_][n1_]>::default_iterator> >
21499 >::type
21500 from(value_type_ (&a)[n0_][n1_])
21501 {
21502 typedef array<typename array_signature_traits<value_type_[n0_][n1_]>::signature,
21503 default_array_traits,
21504 reference_rep<typename array_signature_traits<value_type_[n0_][n1_]>::default_iterator>
21505 > result_type;
21506
21507 return result_type(&a[0][0], typename result_type::size_type());
21508 };
21509
21510 template<
21511 typename value_type_,
21512 int n0_,
21513 int n1_,
21514 int n2_
21515 >
21516 LITE_INLINE
21517 typename detail::enable_if<
21518 array_signature_traits<value_type_[n0_][n1_][n2_]>::is_fixed_size,
21519 const array<typename array_signature_traits<value_type_[n0_][n1_][n2_]>::signature,
21520 default_array_traits,
21521 reference_rep<typename array_signature_traits<value_type_[n0_][n1_][n2_]>::default_iterator> >
21522 >::type
21523 from(value_type_ (&a)[n0_][n1_][n2_])
21524 {
21525 typedef array<typename array_signature_traits<value_type_[n0_][n1_][n2_]>::signature,
21526 default_array_traits,
21527 reference_rep<typename array_signature_traits<value_type_[n0_][n1_][n2_]>::default_iterator>
21528 > result_type;
21529
21530 return result_type(&a[0][0][0], typename result_type::size_type());
21531 };
21532
21533
21534 #endif // DOCUMENTATION_ONLY
21535
21536
21537
21538
21539
21540 #ifdef DOCUMENTATION_ONLY
21541
21560 template<typename iterator_type_>
21561 const array<...>
21562 from(iterator_type_ it, int n0 ..., int nN);
21563
21564 #else // DOCUMENTATION_ONLY
21565
21566 template<typename iterator_type_>
21567 LITE_INLINE
21568 const array<
21569 typename std::iterator_traits<iterator_type_>::value_type[1],
21570 default_array_traits,
21571 reference_rep<pack<iterator_type_, constant<int, 1> > > >
21572 from(iterator_type_ it, int n0)
21573 {
21574 typedef array<
21575 typename std::iterator_traits<iterator_type_>::value_type[1],
21576 default_array_traits,
21577 reference_rep<pack<iterator_type_, constant<int, 1> > >
21578 > result_type;
21579
21580 typedef typename result_type::iterator iterator_type;
21581
21582 return result_type(
21583 iterator_type(it, 1),
21584 typename result_type::size_type(n0));
21585 }
21586
21587 template<typename iterator_type_>
21588 LITE_INLINE
21589 const array<
21590 typename std::iterator_traits<iterator_type_>::value_type[1][1],
21591 default_array_traits,
21592 reference_rep<pack<iterator_type_, int, constant<int, 1> > > >
21593 from(iterator_type_ it, int n0, int n1)
21594 {
21595 typedef array<
21596 typename std::iterator_traits<iterator_type_>::value_type[1][1],
21597 default_array_traits,
21598 reference_rep<pack<iterator_type_, int, constant<int, 1> > >
21599 > result_type;
21600
21601 typedef typename result_type::iterator iterator_type;
21602
21603 return result_type(
21604 iterator_type(it, n1, 1),
21605 typename result_type::size_type(n0,n1));
21606 }
21607
21608 template<typename iterator_type_>
21609 LITE_INLINE
21610 const array<
21611 typename std::iterator_traits<iterator_type_>::value_type[1][1][1],
21612 default_array_traits,
21613 reference_rep<pack<iterator_type_, int, int, constant<int, 1> > > >
21614 from(iterator_type_ it, int n0, int n1, int n2)
21615 {
21616 typedef array<
21617 typename std::iterator_traits<iterator_type_>::value_type[1][1][1],
21618 default_array_traits,
21619 reference_rep<pack<iterator_type_, int, int, constant<int, 1> > >
21620 > result_type;
21621
21622 typedef typename result_type::iterator iterator_type;
21623
21624 return result_type(
21625 iterator_type(it, n1*n2, n2, 1),
21626 typename result_type::size_type(n0,n1,n2));
21627 }
21628
21629
21630 #endif // DOCUMENTATION_ONLY
21631
21632
21633
21634
21635
21636 #ifdef DOCUMENTATION_ONLY
21637
21656 template<typename iterator_type_, typename type0_ ..., typename typeN_>
21657 const array<...>
21658 from(iterator_type_ it, const pack<type0_ ..., typeN_>& size);
21659
21660 #else // DOCUMENTATION_ONLY
21661
21662
21663 template<
21664 typename iterator_type_,
21665 typename type0_
21666 >
21667 LITE_INLINE
21668 const array<
21669 typename detail::size_to_signature<
21670 pack<type0_>,
21671 typename std::iterator_traits<iterator_type_>::value_type
21672 >::type,
21673 default_array_traits,
21674 reference_rep<
21675 typename array_signature_traits<
21676 typename detail::size_to_signature<
21677 pack<type0_>,
21678 typename std::iterator_traits<iterator_type_>::value_type
21679 >::type,
21680 iterator_type_
21681 >::default_iterator>
21682 >
21683 from(
21684 iterator_type_ it,
21685 const pack<type0_>& size)
21686 {
21687 typedef array<
21688 typename detail::size_to_signature<
21689 pack<type0_>,
21690 typename std::iterator_traits<iterator_type_>::value_type
21691 >::type,
21692 default_array_traits,
21693 reference_rep<
21694 typename array_signature_traits<
21695 typename detail::size_to_signature<
21696 pack<type0_>,
21697 typename std::iterator_traits<iterator_type_>::value_type
21698 >::type,
21699 iterator_type_
21700 >::default_iterator>
21701 > result_type;
21702
21703 typedef typename result_type::iterator iterator_type;
21704
21705 return result_type(
21706 iterator_type(it, 1),
21707 size);
21708 }
21709
21710 template<
21711 typename iterator_type_,
21712 typename type0_,
21713 typename type1_
21714 >
21715 LITE_INLINE
21716 const array<
21717 typename detail::size_to_signature<
21718 pack<type0_,type1_>,
21719 typename std::iterator_traits<iterator_type_>::value_type
21720 >::type,
21721 default_array_traits,
21722 reference_rep<
21723 typename array_signature_traits<
21724 typename detail::size_to_signature<
21725 pack<type0_,type1_>,
21726 typename std::iterator_traits<iterator_type_>::value_type
21727 >::type,
21728 iterator_type_
21729 >::default_iterator>
21730 >
21731 from(
21732 iterator_type_ it,
21733 const pack<type0_, type1_>& size)
21734 {
21735 typedef array<
21736 typename detail::size_to_signature<
21737 pack<type0_,type1_>,
21738 typename std::iterator_traits<iterator_type_>::value_type
21739 >::type,
21740 default_array_traits,
21741 reference_rep<
21742 typename array_signature_traits<
21743 typename detail::size_to_signature<
21744 pack<type0_,type1_>,
21745 typename std::iterator_traits<iterator_type_>::value_type
21746 >::type,
21747 iterator_type_
21748 >::default_iterator>
21749 > result_type;
21750
21751 typedef typename result_type::iterator iterator_type;
21752
21753 return result_type(
21754 iterator_type(it, size.i1, 1),
21755 size);
21756 }
21757
21758 template<
21759 typename iterator_type_,
21760 typename type0_,
21761 typename type1_,
21762 typename type2_
21763 >
21764 LITE_INLINE
21765 const array<
21766 typename detail::size_to_signature<
21767 pack<type0_,type1_,type2_>,
21768 typename std::iterator_traits<iterator_type_>::value_type
21769 >::type,
21770 default_array_traits,
21771 reference_rep<
21772 typename array_signature_traits<
21773 typename detail::size_to_signature<
21774 pack<type0_,type1_,type2_>,
21775 typename std::iterator_traits<iterator_type_>::value_type
21776 >::type,
21777 iterator_type_
21778 >::default_iterator>
21779 >
21780 from(
21781 iterator_type_ it,
21782 const pack<type0_, type1_, type2_>& size)
21783 {
21784 typedef array<
21785 typename detail::size_to_signature<
21786 pack<type0_,type1_,type2_>,
21787 typename std::iterator_traits<iterator_type_>::value_type
21788 >::type,
21789 default_array_traits,
21790 reference_rep<
21791 typename array_signature_traits<
21792 typename detail::size_to_signature<
21793 pack<type0_,type1_,type2_>,
21794 typename std::iterator_traits<iterator_type_>::value_type
21795 >::type,
21796 iterator_type_
21797 >::default_iterator>
21798 > result_type;
21799
21800 typedef typename result_type::iterator iterator_type;
21801
21802 return result_type(
21803 iterator_type(it, size.i1*size.i2, size.i2, 1),
21804 size);
21805 }
21806
21807
21808 #endif // !DOCUMENTATION_ONLY
21809
21810
21811
21812
21813
21814 template<typename signature_, typename traits_type_, typename rep_>
21815 LITE_INLINE
21816 array<signature_, traits_type_, rep_>&
21817 from(array<signature_, traits_type_, rep_>& a)
21818 {
21819 return a;
21820 }
21821
21822 template<typename signature_, typename traits_type_, typename rep_>
21823 LITE_INLINE
21824 const array<signature_, traits_type_, rep_>&
21825 from(const array<signature_, traits_type_, rep_>& a)
21826 {
21827 return a;
21828 }
21829
21830
21831
21832
21833
21834 #ifdef DOCUMENTATION_ONLY
21835
21859 template<
21860 typename dst_array_type_,
21861 typename src_signature_,
21862 typename src_traits_type_,
21863 typename src_rep_>
21864 const array<...>
21865 array_cast(const array<src_signature_, src_traits_type_, src_rep_>& ar);
21866
21867 #else // DOCUMENTATION_ONLY
21868
21869 template<
21870 typename dst_array_type_,
21871 typename src_signature_,
21872 typename src_traits_type_,
21873 typename src_rep_>
21874 LITE_INLINE
21875 typename detail::enable_if<
21876 (array_signature_traits<src_signature_>::dimensions == dst_array_type_::dimensions),
21877 const array<
21878 typename dst_array_type_::signature,
21879 typename dst_array_type_::traits_type,
21880 reference_rep<typename array<src_signature_, src_traits_type_, src_rep_>::const_iterator> >
21881 >::type
21882 array_cast(const array<src_signature_, src_traits_type_, src_rep_>& a)
21883 {
21884 typedef array<
21885 typename dst_array_type_::signature,
21886 typename dst_array_type_::traits_type,
21887 reference_rep<typename array<src_signature_, src_traits_type_, src_rep_>::const_iterator> >
21888 result_type;
21889
21890 typename result_type::size_type new_size(a.size());
21891
21892 LITE_ARRAY_SIZE_CHECK(a.size(), new_size, "array_cast<A>(A): source/target sizes do not match");
21893
21894 return result_type(a.begin(), new_size);
21895 }
21896
21897 template<
21898 typename dst_array_type_,
21899 typename src_signature_,
21900 typename src_traits_type_,
21901 typename src_rep_>
21902 LITE_INLINE
21903 typename detail::enable_if<
21904 (array_signature_traits<src_signature_>::dimensions == dst_array_type_::dimensions),
21905 const array<
21906 typename dst_array_type_::signature,
21907 typename dst_array_type_::traits_type,
21908 reference_rep<typename array<src_signature_, src_traits_type_, src_rep_>::iterator> >
21909 >::type
21910 array_cast(array<src_signature_, src_traits_type_, src_rep_>& a)
21911 {
21912 typedef array<
21913 typename dst_array_type_::signature,
21914 typename dst_array_type_::traits_type,
21915 reference_rep<typename array<src_signature_, src_traits_type_, src_rep_>::iterator> >
21916 result_type;
21917
21918 typename result_type::size_type new_size(a.size());
21919
21920 LITE_ARRAY_SIZE_CHECK(a.size(), new_size, "array_cast<A>(A): source/target sizes do not match");
21921
21922 return result_type(a.begin(), new_size);
21923 }
21924
21925 #endif // !DOCUMENTATION_ONLY
21926
21927
21928
21929
21930
21931 template<
21932 typename char_type_ ,
21933 typename char_traits_type_,
21934 typename value_type_,
21935 typename traits_type_,
21936 typename rep_>
21937 void print(
21938 std::basic_ostream<char_type_, char_traits_type_>& os,
21939 const array<value_type_, traits_type_, rep_>& ar,
21940 int level
21941 )
21942 {
21943 std::streamsize width = os.width();
21944 bool punct = (os.flags() & std::ios_base::boolalpha) != 0;
21945
21946 os.width(0);
21947
21948 if (punct)
21949 os << '[';
21950
21951 os.width(width);
21952 os << ar();
21953
21954 if (punct)
21955 os << ']';
21956 }
21957
21958 template<
21959 typename char_type_ ,
21960 typename char_traits_type_,
21961 typename value_type_,
21962 int n0_,
21963 typename traits_type_,
21964 typename rep_>
21965 void print(
21966 std::basic_ostream<char_type_, char_traits_type_>& os,
21967 const array<value_type_[n0_], traits_type_, rep_>& ar,
21968 int
21969 )
21970 {
21971 std::streamsize width = os.width();
21972 bool punct = (os.flags() & std::ios_base::boolalpha) != 0;
21973 const int n =ar.size().i0;
21974
21975 os.width(0);
21976
21977 if (punct)
21978 os << '[';
21979
21980 for (int i=0; i<n; i++) {
21981 if (i != 0)
21982 os << ' ';
21983 os.width(width);
21984 os << ar[i];
21985 }
21986
21987 if (punct)
21988 os << ']';
21989 }
21990
21991 template<
21992 typename char_type_ ,
21993 typename char_traits_type_,
21994 typename tail_type_,
21995 int n0_,
21996 int n1_,
21997 typename traits_type_,
21998 typename rep_>
21999 void print(
22000 std::basic_ostream<char_type_, char_traits_type_>& os,
22001 const array<tail_type_[n0_][n1_], traits_type_, rep_>& ar,
22002 int level =0
22003 )
22004 {
22005 std::streamsize width = os.width();
22006 bool punct = (os.flags() & std::ios_base::boolalpha) != 0;
22007 const int n =ar.size().i0;
22008
22009 os.width(0);
22010
22011 if (punct) {
22012 os << '[' << '\n';
22013 for (int j=0; j<level; j++) { os.width(width); os << ' '; }
22014 }
22015 for (int i=0; i<n; i++) {
22016 os.width(width);
22017 os << ' ';
22018 os.width(width);
22019 print(os, ar[row(i)], level+1);
22020 if (i < n-1) {
22021 os << "\n";
22022 for (int j=0; j<level; j++) { os.width(width); os << ' '; }
22023 }
22024 }
22025 if (punct) {
22026 os << '\n';
22027 for (int j=0; j<level; j++) { os.width(width); os << ' '; }
22028 os << ']';
22029 }
22030 }
22031
22060 template<
22061 typename char_type_ ,
22062 typename char_traits_type_,
22063 typename signature_,
22064 typename traits_type_,
22065 typename rep_>
22066 std::basic_ostream<char_type_, char_traits_type_>&
22067 operator<<(
22068 std::basic_ostream<char_type_, char_traits_type_>& os,
22069 const array<signature_, traits_type_, rep_>& ar)
22070 {
22071 print(os, ar, 0);
22072 return os;
22073 }
22074
22075
22076
22077
22078
22079 template<
22080 typename char_type_ ,
22081 typename char_traits_type_,
22082 typename value_type_,
22083 typename traits_type_,
22084 typename rep_>
22085 void scan(
22086 std::basic_istream<char_type_, char_traits_type_>& is,
22087 const array<value_type_, traits_type_, rep_>& ar,
22088 bool fancy
22089 )
22090 {
22091 char_type_ ch;
22092
22093 if (fancy && !(is >> ch && is.narrow(ch, '\0') == '[')) {
22094 is.setstate(std::ios_base::failbit);
22095 return;
22096 }
22097
22098 is >> ar();
22099
22100 ch = char_type_();
22101
22102 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
22103 is.setstate(std::ios_base::failbit);
22104 return;
22105 }
22106 }
22107
22108 template<
22109 typename char_type_ ,
22110 typename char_traits_type_,
22111 typename value_type_,
22112 typename traits_type_,
22113 typename rep_>
22114 void scan(
22115 std::basic_istream<char_type_, char_traits_type_>& is,
22116 array<value_type_, traits_type_, rep_>& ar,
22117 bool fancy
22118 )
22119 {
22120 char_type_ ch;
22121
22122 if (fancy && !(is >> ch && is.narrow(ch, '\0') == '[')) {
22123 is.setstate(std::ios_base::failbit);
22124 return;
22125 }
22126
22127 is >> ar();
22128
22129 ch = char_type_();
22130
22131 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
22132 is.setstate(std::ios_base::failbit);
22133 return;
22134 }
22135 }
22136
22137
22138
22139 template<
22140 typename char_type_ ,
22141 typename char_traits_type_,
22142 typename value_type_,
22143 int n0_,
22144 typename traits_type_,
22145 typename rep_>
22146 void scan(
22147 std::basic_istream<char_type_, char_traits_type_>& is,
22148 const array<value_type_[n0_], traits_type_, rep_>& ar,
22149 bool fancy
22150 )
22151 {
22152 const int n =ar.size().i0;
22153 char_type_ ch;
22154
22155 if (fancy && !(is >> ch && is.narrow(ch, '\0') == '[')) {
22156 is.setstate(std::ios_base::failbit);
22157 return;
22158 }
22159
22160 for (int i=0; i<n; i++)
22161 is >> ar[i];
22162
22163 ch = char_type_();
22164
22165 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
22166 is.setstate(std::ios_base::failbit);
22167 return;
22168 }
22169 }
22170
22171 template<
22172 typename char_type_ ,
22173 typename char_traits_type_,
22174 typename value_type_,
22175 int n0_,
22176 typename traits_type_,
22177 typename rep_>
22178 void scan(
22179 std::basic_istream<char_type_, char_traits_type_>& is,
22180 array<value_type_[n0_], traits_type_, rep_>& ar,
22181 bool fancy
22182 )
22183 {
22184 const int n =ar.size().i0;
22185 char_type_ ch;
22186
22187 if (fancy && !(is >> ch && is.narrow(ch, '\0') == '[')) {
22188 is.setstate(std::ios_base::failbit);
22189 return;
22190 }
22191
22192 for (int i=0; i<n; i++)
22193 is >> ar[i];
22194
22195 ch = char_type_();
22196
22197 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
22198 is.setstate(std::ios_base::failbit);
22199 return;
22200 }
22201 }
22202
22203
22204
22205 template<
22206 typename char_type_ ,
22207 typename char_traits_type_,
22208 typename tail_type_,
22209 int n0_,
22210 int n1_,
22211 typename traits_type_,
22212 typename rep_>
22213 void scan(
22214 std::basic_istream<char_type_, char_traits_type_>& is,
22215 const array<tail_type_[n0_][n1_], traits_type_, rep_>& ar,
22216 bool fancy
22217 )
22218 {
22219 const int n =ar.size().i0;
22220 char_type_ ch;
22221
22222 if (fancy && !(is >> ch && is.narrow(ch, '\0') == '[')) {
22223 is.setstate(std::ios_base::failbit);
22224 return;
22225 }
22226
22227 for (int i=0; i<n; i++)
22228 scan(is, ar[row(i)], fancy);
22229
22230 ch = char_type_();
22231
22232 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
22233 is.setstate(std::ios_base::failbit);
22234 return;
22235 }
22236 }
22237
22238
22239 template<
22240 typename char_type_ ,
22241 typename char_traits_type_,
22242 typename tail_type_,
22243 int n0_,
22244 int n1_,
22245 typename traits_type_,
22246 typename rep_>
22247 void scan(
22248 std::basic_istream<char_type_, char_traits_type_>& is,
22249 array<tail_type_[n0_][n1_], traits_type_, rep_>& ar,
22250 bool fancy
22251 )
22252 {
22253 const int n =ar.size().i0;
22254 char_type_ ch;
22255
22256 if (fancy && !(is >> ch && is.narrow(ch, '\0') == '[')) {
22257 is.setstate(std::ios_base::failbit);
22258 return;
22259 }
22260
22261 for (int i=0; i<n; i++)
22262 scan(is, ar[row(i)], fancy);
22263
22264 ch = char_type_();
22265
22266 if (fancy && !(is >> ch && is.narrow(ch, '\0') == ']')) {
22267 is.setstate(std::ios_base::failbit);
22268 return;
22269 }
22270 }
22271
22272
22273
22303 template<
22304 typename char_type_ ,
22305 typename char_traits_type_,
22306 typename signature_,
22307 typename traits_type_,
22308 typename rep_>
22309 std::basic_istream<char_type_, char_traits_type_>&
22310 operator>>(
22311 std::basic_istream<char_type_, char_traits_type_>& is,
22312 const array<signature_, traits_type_, rep_>& ar)
22313 {
22314 char_type_ ch;
22315
22316 if (!(is >> ch))
22317 return is;
22318
22319 bool fancy = is.narrow(ch, '\0') == '[';
22320
22321 is.putback(ch);
22322 scan(is, ar, fancy);
22323 return is;
22324 }
22325
22358 template<
22359 typename char_type_ ,
22360 typename char_traits_type_,
22361 typename signature_,
22362 typename traits_type_,
22363 typename rep_>
22364 std::basic_istream<char_type_, char_traits_type_>&
22365 operator>>(
22366 std::basic_istream<char_type_, char_traits_type_>& is,
22367 array<signature_, traits_type_, rep_>& ar)
22368 {
22369 char_type_ ch;
22370
22371 if (!(is >> ch))
22372 return is;
22373
22374 bool fancy = is.narrow(ch, '\0') == '[';
22375
22376 is.putback(ch);
22377 scan(is, ar, fancy);
22378 return is;
22379 }
22380
22381 }
22382
22383
22384
22385
22386 namespace std {
22387
22388 template<typename signature_, typename traits_type_, typename rep_>
22389 LITE_INLINE void
22390 swap(
22391 const lite::array<signature_, traits_type_, rep_>& a,
22392 const lite::array<signature_, traits_type_, rep_>& b)
22393 {
22394 a.swap(b);
22395 }
22396
22397 template<typename signature_, typename traits_type_, typename rep_>
22398 LITE_INLINE void
22399 swap(
22400 lite::array<signature_, traits_type_, rep_>& a,
22401 lite::array<signature_, traits_type_, rep_>& b)
22402 {
22403 a.swap(b);
22404 }
22405
22406 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
22407 LITE_INLINE void
22408 swap(
22409 const lite::array<signature_, traits_type_, l_rep_>& a,
22410 const lite::array<signature_, traits_type_, r_rep_>& b)
22411 {
22412 a.swap(b);
22413 }
22414
22415 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
22416 LITE_INLINE void
22417 swap(
22418 const lite::array<signature_, traits_type_, l_rep_>& a,
22419 lite::array<signature_, traits_type_, r_rep_>& b)
22420 {
22421 a.swap(b);
22422 }
22423
22424 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
22425 LITE_INLINE void
22426 swap(
22427 lite::array<signature_, traits_type_, l_rep_>& a,
22428 const lite::array<signature_, traits_type_, r_rep_>& b)
22429 {
22430 a.swap(b);
22431 }
22432
22433 template<typename signature_, typename traits_type_, typename l_rep_, typename r_rep_>
22434 LITE_INLINE void
22435 swap(
22436 lite::array<signature_, traits_type_, l_rep_>& a,
22437 lite::array<signature_, traits_type_, r_rep_>& b)
22438 {
22439 a.swap(b);
22440 }
22441
22442 }
22443
22444 #ifdef _MSC_VER
22445 #pragma warning(pop)
22446 #endif // _MSC_VER
22447
22448 #endif // LITE_ARRAY_HPP
22449
22450
22451