diff --git a/doc/v2/containers.html b/doc/v2/containers.html index b9c47c9d..791edc86 100755 --- a/doc/v2/containers.html +++ b/doc/v2/containers.html @@ -171,7 +171,7 @@
   class_< std::vector<int> > ("vector_int")
-    .def (our_namespace::container_suite< std::vector<int> >());
+    .def (indexing::container_suite< std::vector<int> >());
 

@@ -211,7 +211,7 @@ #include "algo_selector.hpp" #include "visitor.hpp" -namespace our_namespace { +namespace boost { namespace python { namespace indexing { typedef return_value_policy<return_by_value> default_container_policies; template<class Container, class Algorithms = algo_selector<Container> > @@ -221,7 +221,7 @@ namespace our_namespace { template<typename Policy> static visitor<Algorithms, Policy> with_policies (Policy const &policy); }; -} +} } }

@@ -232,14 +232,14 @@ namespace our_namespace {
  1. - It relies on the our_namespace::algo_selector + It relies on the indexing::algo_selector template, which uses partial template specialization, to select what functionality to provide for the container.
  2. - It derives from the our_namespace::visitor + It derives from the indexing::visitor template, using a return_by_value return policy. This is a reasonable default, and follows the Boost.Python idiom of passing a default-constructed object @@ -250,7 +250,7 @@ namespace our_namespace { The with_policies static function template generates different instances of the - our_namespace::visitor template, with + indexing::visitor template, with client-provided policies.
  3. @@ -266,7 +266,7 @@ namespace our_namespace {
       class_< std::list<heavy_class> > ("list_heavy_class")
    -    .def (our_namespace::container_suite< std::list<heavy_class> >
    +    .def (indexing::container_suite< std::list<heavy_class> >
               ::with_policies (my_policies));
     
    @@ -467,7 +467,7 @@ static void visitor_helper (PythonClass &, Policy const &); In order to include a custom ValueTraits class into the container suite, it is easiest to supply it as a specialization of the template - our_namespace::value_traits for the container's + indexing::value_traits for the container's element type. The existing ContainerTraits classes all make use of value_traits<container::value_type>, and so @@ -484,21 +484,21 @@ static void visitor_helper (PythonClass &, Policy const &); errors caused by an attempt to provide the Python find or sort methods. The solution is to write a specialized version of - our_namespace::value_traits that disables the + indexing::value_traits that disables the appropriate features. For example:

    -namespace our_namespace {
    +namespace boost { namespace python { namespace indexing {
       template<>
       struct value_traits<my_type> : public value_traits<int>
       {
         static bool const equality_comparable = false;
         static bool const lessthan_comparable = false;
       };
    -}
    +} } }
     

    @@ -516,7 +516,7 @@ namespace our_namespace {

    -namespace our_namespace {
    +namespace boost { namespace python { namespace indexing {
       template<typename T>
       struct value_traits {
         static bool const equality_comparable = true;
    @@ -526,7 +526,7 @@ namespace our_namespace {
         static void visitor_helper (PythonClass &, Policy const &)
         { }
       };
    -}
    +} } }
     

    @@ -994,13 +994,13 @@ static void visitor_helper (PythonClass &, Policy const &);

    -namespace our_namespace {
    +namespace boost { namespace python { namespace indexing {
       template<>
       struct algo_selector<my_container>
         : public default_algorithms<my_container_traits>
       {
       };
    -}
    +} } }
     

    @@ -1159,7 +1159,7 @@ BOOST_PYTHON_MODULE(test_simple) {

    -namespace our_namespace {
    +namespace boost { namespace python { namespace indexing {
       template<typename ContainerTraits>
       struct default_algorithms
       {
    @@ -1191,7 +1191,7 @@ namespace our_namespace {
         template<typename PythonClass, typename Policy>
         static void visitor_helper (PythonClass &, Policy const &);
       };
    -}
    +} } }
     

    @@ -1199,7 +1199,7 @@ namespace our_namespace {

    - The existing our_namespace::algo_selector template + The existing indexing::algo_selector template uses partial specializations and public derivation to select an Algorithms implementation suitable for any of the standard container types. Exactly how it does this should be @@ -1401,74 +1401,78 @@ namespace our_namespace {

    -template<class Container
    -	 , class Holder = identity<Container> >
    -class container_proxy
    -{
    -public:
    -  typedef typename Container::size_type size_type;
    -  typedef typename Container::difference_type difference_type;
    -  typedef typename Container::value_type raw_value_type;
    +namespace boost { namespace python { namespace indexing {
    +  template<class Container
    +  	 , class Holder = identity<Container> >
    +  class container_proxy
    +  {
    +  public:
    +    typedef typename Container::size_type size_type;
    +    typedef typename Container::difference_type difference_type;
    +    typedef typename Container::value_type raw_value_type;
     
    -  typedef typename Holder::held_type held_type;
    +    typedef typename Holder::held_type held_type;
     
    -  typedef implementation defined value_type;
    -  typedef implementation defined const_value_type;
    +    typedef implementation defined value_type;
    +    typedef implementation defined const_value_type;
     
    -  typedef value_type        reference;       // Has reference semantics
    -  typedef const_value_type  const_reference; // Has reference semantics
    +    typedef value_type        reference;       // Has reference semantics
    +    typedef const_value_type  const_reference; // Has reference semantics
     
    -  struct iterator { implementation defined }
    +    struct iterator { implementation defined }
     
    -  container_proxy ();
    -  explicit container_proxy (held_type const &);
    -  template<typename Iter> container_proxy (Iter, Iter);
    +    container_proxy ();
    +    explicit container_proxy (held_type const &);
    +    template<typename Iter> container_proxy (Iter, Iter);
     
    -  container_proxy (container_proxy const &);
    -  container_proxy &operator= (container_proxy const &);
    -  ~container_proxy ();
    +    container_proxy (container_proxy const &);
    +    container_proxy &operator= (container_proxy const &);
    +    ~container_proxy ();
     
    -  Container const &raw_container() const;   // OK to expose const reference
    +    Container const &raw_container() const;   // OK to expose const reference
     
    -  reference       at (size_type);
    -  const_reference at (size_type) const;
    +    reference       at (size_type);
    +    const_reference at (size_type) const;
     
    -  reference       operator[] (size_type);
    -  const_reference operator[] (size_type) const;
    +    reference       operator[] (size_type);
    +    const_reference operator[] (size_type) const;
     
    -  size_type size() const;
    -  size_type capacity() const;
    -  void reserve(size_type);
    +    size_type size() const;
    +    size_type capacity() const;
    +    void reserve(size_type);
     
    -  iterator begin();
    -  iterator end();
    +    iterator begin();
    +    iterator end();
     
    -  iterator erase (iterator);
    -  iterator erase (iterator, iterator);
    -  iterator insert (iterator, raw_value_type const &);
    -  template<typename Iter> void insert (iterator, Iter, Iter);
    +    iterator erase (iterator);
    +    iterator erase (iterator, iterator);
    +    iterator insert (iterator, raw_value_type const &);
    +    template<typename Iter> void insert (iterator, Iter, Iter);
     
    -  void push_back (raw_value_type const &);
    +    void push_back (raw_value_type const &);
     
    -  value_type pop_back ();
    -};
    +    value_type pop_back ();
    +  };
    +} } }
     

    The identity template.

    -template<typename T> struct identity {
    -  typedef T held_type;
    +namespace boost { namespace python { namespace indexing {
    +  template<typename T> struct identity {
    +    typedef T held_type;
     
    -  static T &       get(T &       obj) { return obj; }
    -  static T const & get(T const & obj) { return obj; }
    +    static T &       get(T &       obj) { return obj; }
    +    static T const & get(T const & obj) { return obj; }
     
    -  static T    create ()                     { return T(); }
    -  static T    copy   (T const &copy)        { return copy; }
    -  static void assign (T &to, T const &from) { to = from; }
    -  static void pre_destruction (T &)         { }
    -};
    +    static T    create ()                     { return T(); }
    +    static T    copy   (T const &copy)        { return copy; }
    +    static void assign (T &to, T const &from) { to = from; }
    +    static void pre_destruction (T &)         { }
    +  };
    +} } }
     

    @@ -1476,19 +1480,21 @@ template<typename T> struct identity { The deref template.
    -template<typename P> struct deref {
    -  typedef P held_type;
    +namespace boost { namespace python { namespace indexing {
    +  template<typename P> struct deref {
    +    typedef P held_type;
     
    -  typedef typename boost::iterator_value<P>::type     value;
    +    typedef typename boost::iterator_value<P>::type     value;
     
    -  static value &       get (P &       ptr)  { return *ptr; }
    -  static value const & get (P const & ptr)  { return *ptr; }
    +    static value &       get (P &       ptr)  { return *ptr; }
    +    static value const & get (P const & ptr)  { return *ptr; }
     
    -  static P    create ()                     { return P(); }
    -  static P    copy   (P const &copy)        { return copy; }
    -  static void assign (P &to, P const &from) { to = from; }
    -  static void pre_destruction (P &)         { }
    -};
    +    static P    create ()                     { return P(); }
    +    static P    copy   (P const &copy)        { return copy; }
    +    static void assign (P &to, P const &from) { to = from; }
    +    static void pre_destruction (P &)         { }
    +  };
    +} } }
     

    @@ -1651,7 +1657,8 @@ namespace boost { namespace python { namespace indexing { directly, as in the following example:
    -  using our_namespace;
    +  using namespace boost::python;
    +  using namespace boost::python::indexing;
     
       class_<std::vector<int> > ("vector_int")
         .def (visitor <