ivl 679
ivl/details/core/keyword_operators/rval.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_CORE_DETAILS_OPERATION_RVAL_HPP
00025 #define IVL_CORE_DETAILS_OPERATION_RVAL_HPP
00026 
00027 namespace ivl {
00028 
00029 namespace core_details {
00030 
00031 template <class A, class DST>
00032 struct rval_tool
00033 {
00034         typedef DST type;
00035         static inline type operate(const A& a) { return type(a); }
00036 };
00037 
00038 template <class A>
00039 struct rval_tool<A, A>
00040 {
00041         typedef const A& type;
00042         static inline const A& operate(const A& a) { return a; }
00043 };
00044 
00045 template <class A>
00046 struct resolve_rval
00047 : public rval_tool<A,
00048 //typename types::
00049 //      change_data_class_set_rec<data::normal, A>::type
00050         typename A::create_new
00051 >
00052 {
00053         typedef typename resolve_rval::type type;
00054 };
00055 
00056 /*
00057 template <class A, class IS_LINEAR>
00058 struct rval_tool {};
00059 
00060 template <class A>
00061 struct rval_tool<A, types::t_false>
00062 {
00063         typedef typename A::create_similar type;
00064         static inline type operate(const A& a) { return type(a); }
00065 };
00066 
00067 template <class A>
00068 struct rval_tool<A, types::t_true>
00069 {
00070         typedef const A& type;
00071         static inline const A& operate(const A& a) { return a; }
00072 };
00073 
00074 template <class A>
00075 struct resolve_rval
00076 : public rval_tool<A, typename A::is_linear>
00077 {
00078         typedef typename resolve_rval::type type;
00079 };
00080 */
00081 /*
00082 template <class A>
00083 struct resolve_is_subreference
00084 : public rval_tool<A, typename types::t_and<typename A::is_writeable,
00085         types::is_base<types::subreference_identifier, A> >::type>
00086 {
00087         typedef typename resolve_rval::type type;
00088 };
00089 */
00090 
00091 } /* namespace core_details */
00092 
00118 template<class A>
00119 typename core_details::resolve_rval<A>::type rval(const A& a)
00120 {
00121         return core_details::resolve_rval<A>::operate(a);
00122 }
00123 
00124 }; /*namespace ivl*/
00125 
00126 #endif // IVL_CORE_DETAILS_OPERATION_RVAL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations