ivl 679
ivl/details/array/impl/slice_array.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_SLICE_ARRAY_HPP
00025 #define IVL_ARRAY_DETAILS_SLICE_ARRAY_HPP
00026 
00027 namespace ivl {
00028 
00029 template<class A>
00030 class slice_array
00031 : public array<typename A::elem_type, data::slice<A> >
00032 {
00033 public:
00034         typedef slice_array this_type;
00035         typedef typename this_type::array_type base_class;
00036 
00037         base_class& base() { return static_cast<base_class&>(*this); }
00038         const base_class& base() const
00039                 { return static_cast<const base_class&>(*this); }
00040 
00041         // convert temporary object to non-const reference
00042         this_type& ref() { return *this; }
00043 
00044         slice_array() { }
00045         slice_array(const this_type& o) : base_class(o.base()) { }
00046         template <class R>
00047         slice_array(const internal::tuple<A&, const R&>& t)
00048                 : base_class(t.v1, t.v2) { }
00049 
00050         //using base_class::operator=;
00051         this_type& operator=(const this_type& o)
00052         {
00053                 base_class::operator=(o);
00054                 return *this;
00055         }
00056         template<class K>
00057         this_type& operator=(const K& o)
00058         {
00059                 base_class::operator=(o);
00060                 return *this;
00061         }
00062 };
00063 
00064 } /* namespace ivl */
00065 
00066 #endif // IVL_ARRAY_DETAILS_SLICE_ARRAY_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations