1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef OBJECT_ITEMS_DWA2002615_HPP
6 # define OBJECT_ITEMS_DWA2002615_HPP
8 # include <boost/python/detail/prefix.hpp>
10 # include <boost/python/proxy.hpp>
11 # include <boost/python/object_core.hpp>
12 # include <boost/python/object_protocol.hpp>
14 namespace boost { namespace python { namespace api {
16 struct const_item_policies
18 typedef object key_type;
19 static object get(object const& target, object const& key);
22 struct item_policies : const_item_policies
24 static object const& set(object const& target, object const& key, object const& value);
25 static void del(object const& target, object const& key);
33 object_operators<U>::operator[](object_cref key)
35 object_cref2 x = *static_cast<U*>(this);
36 return object_item(x, key);
40 inline const_object_item
41 object_operators<U>::operator[](object_cref key) const
43 object_cref2 x = *static_cast<U const*>(this);
44 return const_object_item(x, key);
49 inline const_object_item
50 object_operators<U>::operator[](T const& key) const
52 return (*this)[object(key)];
58 object_operators<U>::operator[](T const& key)
60 return (*this)[object(key)];
63 inline object const_item_policies::get(object const& target, object const& key)
65 return getitem(target, key);
68 inline object const& item_policies::set(
71 , object const& value)
73 setitem(target, key, value);
77 inline void item_policies::del(
84 }}} // namespace boost::python::api
86 #endif // OBJECT_ITEMS_DWA2002615_HPP