VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
functionPropertyMap.h
Go to the documentation of this file.
1 //
2 //=======================================================================
4 //
6 //
10 //=======================================================================
11 //
12 
13 //NOTE: This is copied from boost 1.51, and renamed so it should not
16 
17 #pragma once
18 
19 #include <boost/config.hpp>
20 #include <boost/property_map/property_map.hpp>
21 #include <boost/type_traits.hpp>
22 #include <boost/utility/result_of.hpp>
23 #include <boost/mpl/and.hpp>
24 #include <boost/mpl/not.hpp>
25 #include <utility>
26 
29 
31 
32  template<typename Func, typename Key, typename Ret = typename boost::result_of<const Func(const Key&)>::type>
33  class DtFunctionPropertyMap: public put_get_helper<Ret, DtFunctionPropertyMap<Func, Key, Ret> > {
34  public:
35  typedef Key key_type;
36  typedef Ret reference;
37  typedef typename boost::remove_cv<typename boost::remove_reference<Ret>::type>::type value_type;
38 
39  typedef typename boost::mpl::if_<
40  boost::mpl::and_<
41  boost::is_reference<Ret>,
42  boost::mpl::not_<boost::is_const<Ret> >
43  >,
44  boost::lvalue_property_map_tag,
45  boost::readable_property_map_tag>::type
47 
48  DtFunctionPropertyMap(Func f = Func()) : f(f) {}
49 
50  reference operator[](const Key& k) const {
51  return f(k);
52  }
53 
54  private:
55  Func f;
56  };
57 
58  template<typename Key, typename Func>
60  DtMakeFunctionPropertyMap(const Func& f) {
62  }
63 
64  template<typename Key, typename Ret, typename Func>
65  DtFunctionPropertyMap<Func, Key, Ret>
66  DtMakeFunctionPropertyMap(const Func& f) {
68  }
69 
70 }
reference operator[](const Key &k) const
Definition: functionPropertyMap.h:50
Ret reference
Definition: functionPropertyMap.h:36
Key key_type
Definition: functionPropertyMap.h:35
Func f
Definition: functionPropertyMap.h:55
#define MAK_BOOST_NAMESPACE
Definition: makBoostNamespace.h:13
DtFunctionPropertyMap< Func, Key > DtMakeFunctionPropertyMap(const Func &f)
Definition: functionPropertyMap.h:60
DtFunctionPropertyMap(Func f=Func())
Definition: functionPropertyMap.h:48
boost::remove_cv< typename boost::remove_reference< Ret >::type >::type value_type
Definition: functionPropertyMap.h:37
boost::mpl::if_< boost::mpl::and_< boost::is_reference< Ret >, boost::mpl::not_< boost::is_const< Ret > > >, boost::lvalue_property_map_tag, boost::readable_property_map_tag >::type category
Definition: functionPropertyMap.h:46
Definition: functionPropertyMap.h:33

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)