synaps/base/const_ref_or_val.h

00001 #ifndef __CONST_REF_OR_VAL_H
00002 #define __CONST_REF_OR_VAL_H
00003 
00004 
00005 #include <vector>
00006 #include <synaps/init.h>
00007 
00008 __BEGIN_NAMESPACE_SYNAPS
00009 
00010 
00011 template <class C, class T>
00012 struct copy_or_ref {
00013    // const reference in the general case
00014    typedef const C& type;
00015 };
00016 
00017 template <class C>
00018 struct copy_or_ref<C,__true_type> {
00019    // a copy in the case of built-in types
00020    typedef C type;
00021 };
00022 
00023 template <class C>
00024 struct const_ref_or_value {
00026    typedef typename copy_or_ref<C, typename __type_traits<C>::is_POD_type >::type
00027    func_arg;
00028 };
00029 
00030 #define FUNC_ARG(T) const_ref_or_value<T>::func_arg
00031 
00032 __END_NAMESPACE_SYNAPS
00033 
00034 #endif //__CONST_REF_OR_VAL_H
00035 

SYNAPS DOCUMENTATION
logo