ivl 679
ivl/details/array/impl/common/array_common_base.hpp
00001 /* This file is part of the ivl C++ library <http://image.ntua.gr/ivl>.
00002    A C++ template library extending syntax towards mathematical notation.
00003 
00004    Copyright (C) 2012 Yannis Avrithis <iavr@image.ntua.gr>
00005    Copyright (C) 2012 Kimon Kontosis <kimonas@image.ntua.gr>
00006 
00007    ivl is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU Lesser General Public License 
00009    version 3 as published by the Free Software Foundation.
00010 
00011    Alternatively, you can redistribute it and/or modify it under the terms 
00012    of the GNU General Public License version 2 as published by the Free 
00013    Software Foundation.
00014 
00015    ivl is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00018    See the GNU General Public License for more details.
00019 
00020    You should have received a copy of the GNU General Public License 
00021    and a copy of the GNU Lesser General Public License along 
00022    with ivl. If not, see <http://www.gnu.org/licenses/>. */
00023 
00024 #ifndef IVL_ARRAY_DETAILS_ARRAY_COMMON_BASE_HPP
00025 #define IVL_ARRAY_DETAILS_ARRAY_COMMON_BASE_HPP
00026 
00027 namespace ivl {
00028 
00029 namespace array_details {
00030 
00031 template <bool IS_ELEMENT, bool IS_POINTER>
00032 struct resolve_assign_tool { };
00033 
00034 template <>
00035 struct resolve_assign_tool<true, false>
00036 {
00037         template<class O, class A>
00038         static void assign(O& o, const A& a) { o.derived().assign_element(a); }
00039         template<class O, class A>
00040         static void init_size_with(O& o, const A& a)
00041                 { o.derived().init_size_with_element(a); }
00042 };
00043 
00044 template <>
00045 struct resolve_assign_tool<false, false>
00046 {
00047         template<class O, class A>
00048         /*
00049         Developper Notice: an error here could mean that you are trying to assign
00050         to a read-only array.
00051         */
00052         static void assign(O& o, const A& a) { o.derived().assign_array(a); }
00053         template<class O, class A>
00054         static void init_size_with(O& o, const A& a)
00055                 { o.derived().init_size_with_array(a); }
00056 };
00057 
00058 template <bool D>
00059 struct resolve_assign_tool<D, true>
00060 {
00061         template<class O, class A>
00062         static void assign(O& o, const A* a)
00063         {
00064                 o.derived().assign_array(
00065                         array<A, typename data::ref_iterator<const A*>::type>
00066                                 (a, o.derived().length()));
00067         }
00068         template<class O, class A>
00069         static void init_size_with(O& o, const A* a)
00070         {
00071                 o.derived().init_size_with_array(
00072                         array<A, typename data::ref_iterator<const A*>::type>
00073                                 (a, o.derived().length()));
00074         }
00075 };
00076 
00077 template <class IS_REFERENCING_ARRAY, class DATA_TYPE, class ARE_RELATED>
00078 struct overlap_tool { };
00079 
00080 template <class DATA_TYPE, class ARE_RELATED>
00081 struct overlap_tool<types::t_true, DATA_TYPE, ARE_RELATED>
00082 {
00083         template <class O, class A>
00084         static inline bool operate(const O& o, const A& a)
00085         {
00086                 //TODO: important: this was changed blindly. Please CHECK. !!!@@@@@
00087                 return a.self_overlap(o); 
00088                 // <- was like above
00089                 //
00090                 //return o.overlap(a);
00091         }
00092 };
00093 
00094 template <class C, class D, int E>
00095 struct overlap_tool<types::t_false, data::ref_iterator<C, D, E>, types::t_false>
00096 {
00097         template <class O, class A>
00098         static inline bool operate(const O& o, const A& a)
00099         {
00100                 return a.self_overlap(o);
00101         }
00102 };
00103 
00104 template <class C, class D, int E>
00105 struct overlap_tool<types::t_false, data::ref_iterator<C, D, E>, types::t_true>
00106 {
00107         template <class O, class A>
00108         static inline bool operate(const O& o, const A& a)
00109         {
00110                 return a.self_overlap(o);
00111         }
00112 };
00113 
00114 template <class DATA_TYPE>
00115 struct overlap_tool<types::t_false, DATA_TYPE, types::t_true>
00116 {
00117         // same classes
00118         template <class O, class A>
00119         static inline bool operate(const O& o, const A& a)
00120         {
00121                 return (&o == &a);
00122         }
00123 };
00124 
00125 template <class DATA_TYPE>
00126 struct overlap_tool<types::t_false, DATA_TYPE, types::t_false>
00127 {
00128         // different classes
00129         template <class O, class A> static inline
00130         bool operate(const O& o, const A& a) { return false; }
00131 };
00132 
00133 template <class IS_IVL_ARRAY>
00134 struct overlap_resolve_tool { };
00135 
00136 template <>
00137 struct overlap_resolve_tool<types::t_false>
00138 {
00139         template <class O, class A> static inline
00140         bool operate(const O& o, const A& a)
00141                 { return o.overlap_element(a); }
00142 };
00143 
00144 template <>
00145 struct overlap_resolve_tool<types::t_true>
00146 {
00147         template <class O, class A> static inline
00148         bool operate(const O& o, const A& a)
00149                 { return o.overlap_array(a) || o.overlap_element(a); }
00150 };
00151 
00152 } /* namespace array_details */
00153 
00154 // ----------------------------------------------------------------------------
00155 
00156 namespace array_details {
00157 
00158 template<class T>
00159 struct conv
00160 {
00161         T& c;
00162         conv(T& c) : c(c) { }
00163 };
00164 
00165 } /* namespace array_details */
00166 
00167 template <class T, class A>
00168 class array_common_base<common_container_base<T, A> >
00169 {
00170 private:
00171         typedef array_common_base prv_this_type;
00172         typedef A current_type;
00173         typedef A t;
00174         t& to_current() { return static_cast<t&>(*this); }
00175         const t& to_current() const { return static_cast<const t&>(*this); }
00176         typedef typename types::get_inner_value<T>::type prv_inner_type;
00177         typedef prv_inner_type lt;
00178         typedef const prv_inner_type& l;
00179         /*typedef typename types::t_if<
00180                 types::is_num_value<prv_inner_type, prv_inner_type, types::term>
00181                 ::type l_op;*/
00182 
00183 public:
00184         t& to_array() { return static_cast<t&>(*this); }
00185         const t& to_array() const { return static_cast<const t&>(*this); }
00186         typedef t to_array_type;
00187 
00188         // ------------------------------------------------------------------------
00189         // elem func operators
00190 
00191         unary_elem_func<ivl::uminus_unary_class, current_type> operator-() const
00192                 { return to_current(); }
00193 
00194         unary_elem_func<ivl::uplus_unary_class, current_type> operator+() const
00195                 { return to_current(); }
00196 
00197         unary_elem_func<ivl::bitcmp_unary_class, current_type> operator~() const
00198                 { return to_current(); }
00199 
00200         unary_elem_func<ivl::cnot_unary_class, current_type> operator!() const
00201                 { return to_current(); }
00202 
00203         unary_elem_func<ivl::dereference_unary_class, current_type> operator*()
00204                 const
00205                 { return to_current(); }
00206 
00207         // ------------------------------------------------------------------------
00208         template<class J>
00209         binary_elem_func<ivl::plus_class, t, J> operator+(const J& j) const
00210         {
00211                 return internal::reftpl(to_current(), j);
00212         }
00213         friend
00214         binary_elem_func<ivl::plus_class, lt, t> operator+(l j, const t& a)
00215         {
00216                 return internal::reftpl(j, a);
00217         }
00218 
00219         // ------------------------------------------------------------------------
00220 /*      template<class J>
00221         binary_elem_func<ivl::rdivide_class, t, J> operator/(const J& j) const
00222         {
00223                 return internal::reftpl(to_current(), j);
00224         }
00225         friend
00226         binary_elem_func<ivl::rdivide_class, lt, t> operator/(l j, const t& a)
00227         {
00228                 return internal::reftpl(j, a);
00229         }
00230         */
00231 
00232 
00233         //--
00234         /*template<class J>
00235         binary_elem_func<ivl::minus_class, t, J> operator-(const J& j) const
00236         {
00237                 return internal::reftpl(to_current(), j);
00238         }*/
00239         template<class J>
00240         typename types::t_if<types::is_ptr<J>,
00241         ivl::concat<const current_type, const typename types::deref_ptr<J>::type, 0>,
00242         binary_elem_func<ivl::minus_class, t, J>
00243         >::type operator-(const J& j) const
00244         {
00245                 return internal::reftpl(to_current(), j);
00246         }
00247 
00248         friend
00249         binary_elem_func<ivl::minus_class, lt, t> operator-(l j, const t& a)
00250         {
00251                 return internal::reftpl(j, a);
00252         }
00253         //--
00254         template<class J>
00255         typename types::t_if<types::is_ptr<J>,
00256         ivl::concat<const current_type, const typename types::deref_ptr<J>::type, 1>,
00257         binary_elem_func<ivl::cbitor_class, t, J>
00258         >::type operator|(const J& j) const
00259         {
00260                 return internal::reftpl(to_current(), j);
00261         }
00262 
00263         friend
00264         binary_elem_func<ivl::cbitor_class, lt, t> operator|(l j, const t& a)
00265         {
00266                 return internal::reftpl(j, a);
00267         }
00268         //--
00269         template<class A2>
00270         ivl::concat<const current_type, const A2, 1>
00271         operator|(const A2*& r)
00272         {
00273                 return ivl::concat<const current_type, const A2, 1>
00274                 (to_current(), *r);
00275         }
00276 
00277         template<class A2>
00278         ivl::concat<const current_type, const A2, 0>
00279         operator-(const A2*& r)
00280         {
00281                 return ivl::concat<const current_type, const A2, 0>
00282                 (to_current(), *r);
00283         }
00284 
00285         template<class J>
00286         binary_elem_func<ivl::power_class, t, J> operator->*(const J& j) const
00287         {
00288                 return internal::reftpl(to_current(), j);
00289         }
00290         friend
00291         binary_elem_func<ivl::power_class, lt, t> operator->*(l j, const t& a)
00292         {
00293                 return internal::reftpl(j, a);
00294         }
00295 
00296 
00297 };
00298 
00299 // ----------------------------------------------------------------------------
00300 
00301 // common functions and types for all arrays
00302 template<class T, class SPEC>
00303 class array_common_base<ivl::array<T, SPEC> >
00304 : public array_details::dependable_array_common<T, SPEC,
00305         array_base<T, typename types::derive_opts<ivl::array<T, SPEC> >::type>,
00306         typename array_base<T, typename
00307                 types::derive_opts<ivl::array<T, SPEC> >::type>::is_writeable,
00308         typename array_base<T, typename
00309                 types::derive_opts<ivl::array<T, SPEC> >::type>::is_resizeable
00310         >,
00311 
00312         public array_common_base<common_container_base<T, array<T, SPEC> > >
00313 {
00314 private:
00315         typedef array_common_base prv_this_type;
00316 
00317         // dependable_array_common
00318         typedef typename prv_this_type::direct_base direct_base;
00319 
00320         typedef array<T, SPEC> t;
00321 
00322         typedef t current_type;
00323 
00324         t& to_array() { return static_cast<t&>(*this); }
00325         const t& to_array() const { return static_cast<const t&>(*this); }
00326         t& to_current() { return static_cast<t&>(*this); }
00327         const t& to_current() const { return static_cast<const t&>(*this); }
00328 
00329         typedef typename prv_this_type::derived_type prv_derived_type;
00330 
00331         //prv_derived_type& prv_derived()
00332         //      { return static_cast<prv_derived_type&>(to_array()); }
00333         //const prv_derived_type& prv_derived() const
00334         //      { return static_cast<const prv_derived_type&>(to_array()); }
00335 
00336         template <bool B, bool C> friend class array_details::resolve_assign_tool;
00337 
00338         template <class A>
00339         struct resolve_assign_pointer
00340         {
00341                 // I wished ;| using namespace types;
00342                 typedef typename types::t_and<
00343                         types::t_or<types::is_ptr<typename types::bare_type<A>::type>,
00344                                 types::is_c_array<typename types::bare_type<A>::type> >,
00345                         types::t_or<types::t_eq<T, typename
00346                                         types::deref_ptr<typename types::bare_type<A>::type>::type>,
00347                                 types::t_not<types::is_ptr<T> >
00348                         > >::type is_pointer;
00349         };
00350 
00351         template <class A>
00352         void resolve_assign(const A& a)
00353         {
00354                 using namespace types;
00355                 typedef typename t_not<is_ivl_array<A> >::type is_element;
00356                 // this is so that we can do *this = scalar<derived_type> as non elem.
00357                 typedef typename t_and<
00358                         is_base<types::scalar_identifier, A>,
00359                         is_base<prv_this_type, A> >::type non_elem_scalar;
00360                 typedef typename t_and<is_element, t_not<non_elem_scalar> >
00361                         ::type final_is_element;
00362 
00363                 typedef typename resolve_assign_pointer<A>::is_pointer is_pointer;
00364 
00365                 //internal::nonlin_report(
00366                 //      types::r_descalarize<non_elem_scalar>(a));
00367 
00368                 array_details::resolve_assign_tool<
00369                                 final_is_element::value, is_pointer::value>
00370                         ::assign(this->derived(), 
00371                         types::r_descalarize<non_elem_scalar>(a));
00372         }
00373         template <class A>
00374         void resolve_init_size_with(const A& a)
00375         {
00376                 using namespace types;
00377 
00378                 // TODO: interesting enough, could be checked as method for resolve_assign.
00379                 typedef typename t_not<t_or<
00380                         is_kind_base_eq_recurse<prv_derived_type, A>,
00381                         is_kind_base_eq_recurse<A, prv_derived_type> > >::type is_element;
00382                 // this is so that we can do *this = scalar<derived_type> as non elem.
00383                 // TODO: minor. this code would look better in one place.
00384                 typedef typename t_and<
00385                         is_base<types::scalar_identifier, A>,
00386                         is_base<prv_this_type, A> >::type non_elem_scalar;
00387                 typedef typename t_and<is_element, t_not<non_elem_scalar> >
00388                         ::type final_is_element;
00389 
00390                 typedef typename resolve_assign_pointer<A>::is_pointer is_pointer;
00391 
00392                 array_details::resolve_assign_tool<
00393                         final_is_element::value, is_pointer::value>
00394                         ::init_size_with(this->derived(), 
00395                         types::r_descalarize<non_elem_scalar>(a));
00396         }
00397 
00398 protected:
00399         typedef prv_this_type common_base_class;
00400 
00401         template <class A>
00402         void init_size_with(const A& a)
00403         {
00404                 resolve_init_size_with(a);
00405         }
00406 
00407 public:
00408         typedef t array_type;
00409         typedef t container_type;
00410 
00411         typedef array_base<T, typename
00412                 types::derive_opts<ivl::array<T, SPEC> >::type> base_class;
00413 
00414         typedef typename array_common_base::data_type data_type;
00415 
00416         typedef typename array_common_base::derived_type derived_type;
00417 
00418         typedef T elem_type;
00419 
00420 
00421         //Default constructor
00422         array_common_base() {}
00423 
00424 /*
00425         template<class T, class S, class K>
00426         t& operator=(types::t_if<typename t::has_random_access,
00427                 const array<T, S, K>&, not_a_type
00428 */
00429 
00432         // is supposedly called by ovelap(),
00433         // however may be called on its own.
00434         // overlap(a,b) does overlap(a,b) (which is same as overlap (b,a) )
00435         //                              and also overlap_element(a,b);
00436         // so a complete overlap check would be:
00437         // ovelap(a,b) || overlap_element(b,a)
00438         //
00439         // note that: overlap_element when called in a loop per element, does
00440         // return a complete overlap check.
00441         template <class J>
00442         inline
00443         bool overlap_element(const J& s) const
00444         {
00445                 // for now do nothing.
00446                 return false;
00447         }
00448 
00449         template <class A>
00450         inline
00451         bool overlap_array(const A& a) const
00452         {
00453                 return array_details::overlap_tool<typename
00454                         A::is_referencing_array, typename A::data_type,
00455                         typename types::is_related<derived_type, A>::type>
00456                 ::operate(this->derived(), a.derived());
00457         }
00458 
00459         template <class A>
00460         inline
00461         bool overlap(const A& a) const
00462         {
00463                 return array_details::overlap_resolve_tool<typename
00464                         types::is_ivl_array<A>::type>
00465                         ::operate(this->derived(), a);
00466         }
00467 
00468         template <class S>
00469         bool isequal(const array<T, S>& o)
00470         {
00471                 return ivl::isequal(to_array().derived(), o.derived());
00472         }
00473 
00474         typename types::create_new<T>::type max() const;
00475         typename types::create_new<T>::type min() const;
00476 
00477         //TODO: not Derived! array<T,S>!!!
00480         typedef typename types::t_if<types::t_or_3<types::is_builtin<T>,
00481                types::is_ptr<T>, types::is_ref<T> >,
00482                types::not_a_type, T>::type struct_value_type;
00483 
00484         // ------------------
00485         template<class M, class Z>
00486         member_array<array_type, M> operator[](M Z::* m)
00487         {
00488                 return internal::reftpl(to_array(), m);
00489         }
00490         template<class M, class Z>
00491         member_array<const array_type, M> operator[](M Z::* m) const
00492         {
00493                 return internal::reftpl(to_array(), m);
00494         }
00495         // ------------------
00496         
00497         template<class R, class A1, class Z>
00498         memberfunc_constructor<array_type, internal::tuple<Z, R, A1> > operator[](R (Z::*m)(A1))
00499         {
00500                 return internal::reftpl(to_array(), m);
00501         }
00502         template<class R, class A1, class Z>
00503         memberfunc_constructor<const array_type, internal::tuple<Z, R, A1> > operator[](R (Z::*m)(A1)) const
00504         {
00505                 return internal::reftpl(to_array(), m);
00506         }
00507 //
00508         template<class R, class A1, class Z>
00509         memberfunc_constructor<array_type, internal::tuple<const Z, R, A1> > operator[](R (Z::*m)(A1) const)
00510         {
00511                 return internal::reftpl(to_array(), m);
00512         }
00513         template<class R, class A1, class Z>
00514         memberfunc_constructor<const array_type, internal::tuple<const Z, R, A1> > operator[](R (Z::*m)(A1) const) const
00515         {
00516                 return internal::reftpl(to_array(), m);
00517         }
00518 
00519 
00520         // -------------------------------------------
00521         // ------------------
00522         template<class M, class Z>
00523         member_array<array_type, M> in(M Z::* m)
00524         {
00525                 return internal::reftpl(to_array(), m);
00526         }
00527         template<class M, class Z>
00528         member_array<const array_type, M> in(M Z::* m) const
00529         {
00530                 return internal::reftpl(to_array(), m);
00531         }
00532         // ------------------
00533         
00534         template<class R, class A1, class Z>
00535         memberfunc_constructor<array_type, internal::tuple<Z, R, A1> > in(R (Z::*m)(A1))
00536         {
00537                 return internal::reftpl(to_array(), m);
00538         }
00539         template<class R, class A1, class Z>
00540         memberfunc_constructor<const array_type, internal::tuple<Z, R, A1> > in(R (Z::*m)(A1)) const
00541         {
00542                 return internal::reftpl(to_array(), m);
00543         }
00544 //
00545         template<class R, class A1, class Z>
00546         memberfunc_constructor<array_type, internal::tuple<const Z, R, A1> > in(R (Z::*m)(A1) const)
00547         {
00548                 return internal::reftpl(to_array(), m);
00549         }
00550         template<class R, class A1, class Z>
00551         memberfunc_constructor<const array_type, internal::tuple<const Z, R, A1> > in(R (Z::*m)(A1) const) const
00552         {
00553                 return internal::reftpl(to_array(), m);
00554         }
00555 
00556 
00557         // -------------------------------------------
00558 
00559         // creation of mask array
00560         template<class S>
00561         mask_array<array_type, array<bool, S> > operator[]
00562                 (const array<bool, S>& ba)
00563         {
00564                 return internal::reftpl(to_array(), ba);
00565         }
00566 
00567         template<class S>
00568         mask_array<const array_type, array<bool, S> > operator[]
00569                 (const array<bool, S>& ba) const
00570         {
00571                 return internal::reftpl(to_array(), ba);
00572         }
00573 
00574         // types
00575         typedef mask_array<array_type, array<bool, mem> > mask_array_type;
00576         typedef mask_array<const array_type, array<bool, mem> > const_mask_array_type;
00577 
00578         // -------------
00579         // creation of indirect array]
00580         // Note: advanced compared to others.
00581         // has reference mode and store mode.
00582         template<class I, class S>
00583         ivl::indirect_array<array_type, const typename array<I, S>::derived_type& > operator[]
00584                 (const array<I, S>& sa)
00585         {
00586                 return internal::reftpl(to_array(), sa.derived());
00587         }
00588 
00589         template<class I, class S>
00590         ivl::indirect_array<const array_type, const typename array<I, S>::derived_type& > operator[]
00591                 (const array<I, S>& sa) const
00592         {
00593                 return internal::reftpl(to_array(), sa.derived());
00594         }
00595 
00596         // types
00597         // TODO: deprecated
00598         typedef ivl::indirect_array<array_type, size_array> indirect_array_type;
00599         typedef ivl::indirect_array<const array_type, size_array> const_indirect_array_type;
00600 
00601         typedef ivl::indirect_array<array_type, size_array> indirect_array;
00602         typedef ivl::indirect_array<const array_type, size_array> const_indirect_array;
00603 
00604         // -------------
00605 
00606         // creation of slice array from slice
00607         slice_array<array_type> operator[](const slice& sl)
00608         {
00609                 return internal::reftpl(to_array(), sl);
00610         }
00611 
00612         slice_array<const array_type> operator[](const slice& sl) const
00613         {
00614                 return internal::reftpl(to_array(), sl);
00615         }
00616 
00617         // types
00618         typedef slice_array<array_type> slice_array_type;
00619         typedef slice_array<const array_type> const_slice_array_type;
00620 
00621         // creation of slice array from range
00622         slice_array<array_type> operator[](const ivl::range<size_t>& sl)
00623         {
00624                 return internal::reftpl(to_array(), sl);
00625         }
00626 
00627         slice_array<const array_type> operator[]
00628                 (const ivl::range<size_t>& sl) const
00629         {
00630                 return internal::reftpl(to_array(), sl);
00631         }
00632         /*
00633         array<T, typename data::
00634                 with_type<data::slice<array_type> >::type> operator[](const slice& sl)
00635         {
00636                 return array<T, typename data::slice<array_type>::type>(to_array(), sl);
00637         }
00638 *//*
00639         array<T, typename data::
00640                 with_type<data::slice<const array_type> >::type> operator[]
00641                 (const slice& sl) const
00642         {
00643                 return array<T, typename data::slice<const array_type>::type>
00644                         (to_array(), sl);
00645         }*/
00646 
00647         // creation of slice array from range
00648         /*
00649         array<T, typename data::
00650                 with_type<data::slice<array_type> >::type> operator[](
00651                 const ivl::range<size_t>& sl)
00652         {
00653                 return array<T, typename data::slice<array_type>::type>(to_array(), sl);
00654         }
00655 
00656         array<T, typename data::
00657                 with_type<data::slice<const array_type> >::type> operator[]
00658                 (const ivl::range<size_t>& sl) const
00659         {
00660                 return array<T, typename data::slice<const array_type>::type>
00661                         (to_array(), sl);
00662         }*/
00663 
00664         // creation of all_array
00665         all_array<array_type, false> operator[](const index_array_all_type& all)
00666         {
00667                 return all_array<array_type, false>(to_array());
00668         }
00669 
00670         all_array<array_type, true> operator[](const index_array_all_type& all) const
00671         {
00672                 return all_array<array_type, true>(to_array());
00673         }
00674 
00675         // -------------------------------------------
00676 
00677 /*      template <class A>
00678         derived_type& operator=(const A& o)
00679         {
00680                 direct_base::operator=(o);
00681                 return to_array().derived();
00682         }
00683 */
00684         template <class A>
00685         derived_type& assign(const A& a)
00686         {
00687                 resolve_assign(a);
00688                 return to_array().derived();
00689         }
00690 
00691         // the copy operator. the this == &a is checked only here!
00692         array_common_base& operator=(const array_common_base& a)
00693         {
00694                 //if(this != &a) resolve_assign(a);
00695                 ivl::safe_assign(this->derived(), a);
00696                 return *this;
00697         }
00698 
00699         template <class A>
00700         derived_type& operator=(const A& a)
00701         {
00702                 ivl::safe_assign(this->derived(), a);
00703                 return to_array().derived();
00704         }
00705 
00706         template <class J>
00707         derived_type& operator=(const internal::tuple_rvalue<J>& r)
00708         {
00709                 //TODO: safe output
00710                 r.tuple_output(internal::reftpl(to_array().derived()));
00711 
00712                 //r.derived().safe_output(to_array().derived());
00713                 //typename rvalue_base<J>::derived_type::safe_input
00714                 //r.derived().output(to_array().derived());
00715                 return to_array().derived();
00716         }
00717 
00718 
00719         // operators +=, -= etc., are defined in the readwrite_array_common level.
00720 
00721 /*
00722         template <class S, class K>
00723         derived_type& operator=(const array<T, S, K>& o)
00724         {
00725                 direct_base::operator=(o);
00726                 return to_array().derived();
00727         }
00728 */
00729 
00730 
00731 #if 0
00732 
00743         resizable_mask_array<T, DerivedInfo, false> operator[](const bool_array& ba);
00753         copy_type operator[](const bool_array& ba) const;
00754 
00762         resizable_slice_array<T, DerivedInfo, false> operator[](const size_range& ra);
00763         resizable_slice_array<T, DerivedInfo, false> operator[](const slice& sl);
00773         copy_type operator[](const size_range& ra) const;
00774         copy_type operator[](const slice& sl) const;
00775 
00783         resizable_indirect_array<T, DerivedInfo, false> operator[](const size_array& idx);
00793         copy_type operator[](const size_array& idx) const;
00794 
00803         all_array<T> operator[](const index_array& all);
00809         copy_type operator[](const index_array& all) const;
00810 
00812 #endif
00813 
00814 
00815 
00816 
00817 
00821 
00822         std::ostream& print(std::ostream& os) const
00823         {
00824                 ivl::print(os, to_array().derived());
00825                 return os;
00826         }
00830         array<T, mem> cat(const array<T, mem>& a) const;
00831 
00832 #ifdef IVL_MATLAB
00833 
00839         mxArray* mx() const;
00840 #endif
00841 };
00842 
00843 } /* namespace ivl */
00844 
00845 #endif // IVL_ARRAY_DETAILS_ARRAY_COMMON_BASE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations