mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 06:02:14 +00:00
Automatic reformattings: end of line commas, no space before trailing ( or <
[SVN r20936]
This commit is contained in:
@@ -90,10 +90,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
#else
|
||||
private:
|
||||
#endif
|
||||
static size_type bounds_check (
|
||||
container &, index_param, char const *msg
|
||||
, bool one_past = false
|
||||
, bool truncate = false);
|
||||
static size_type bounds_check(
|
||||
container &, index_param, char const *msg,
|
||||
bool one_past = false,
|
||||
bool truncate = false);
|
||||
// Throws std::out_of_range if necessary. If one_past is set, then
|
||||
// indexes up to container.size() *inclusive* are allowed. If
|
||||
// truncate is set, then out of bounds values are reset to the
|
||||
@@ -109,8 +109,8 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<typename ContainerTraits, typename Ovr = detail::no_override>
|
||||
class assoc_algorithms
|
||||
: public default_algorithms
|
||||
<ContainerTraits
|
||||
, BOOST_DEDUCED_TYPENAME detail::maybe_override
|
||||
<ContainerTraits,
|
||||
BOOST_DEDUCED_TYPENAME detail::maybe_override
|
||||
<assoc_algorithms<ContainerTraits, Ovr>, Ovr>
|
||||
::type>
|
||||
{
|
||||
@@ -157,12 +157,12 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
BOOST_DEDUCED_TYPENAME default_algorithms<ContainerTraits, Ovr>::size_type
|
||||
default_algorithms<ContainerTraits, Ovr>::bounds_check (
|
||||
container &c
|
||||
, index_param ix
|
||||
, char const *msg
|
||||
, bool one_past
|
||||
, bool truncate)
|
||||
default_algorithms<ContainerTraits, Ovr>::bounds_check(
|
||||
container &c,
|
||||
index_param ix,
|
||||
char const *msg,
|
||||
bool one_past,
|
||||
bool truncate)
|
||||
{
|
||||
size_type bound = most_derived::size(c) + (one_past ? 1 : 0);
|
||||
size_type result;
|
||||
@@ -214,16 +214,16 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
BOOST_DEDUCED_TYPENAME default_algorithms<ContainerTraits, Ovr>::iterator
|
||||
default_algorithms<ContainerTraits, Ovr>::find (
|
||||
default_algorithms<ContainerTraits, Ovr>::find(
|
||||
container &c, key_param key)
|
||||
{
|
||||
typedef typename container_traits::value_traits_ value_traits_;
|
||||
typedef typename value_traits_::equal_to comparison;
|
||||
|
||||
return std::find_if (
|
||||
most_derived::begin(c)
|
||||
, most_derived::end(c)
|
||||
, std::bind1st (comparison(), key));
|
||||
return std::find_if(
|
||||
most_derived::begin(c),
|
||||
most_derived::end(c),
|
||||
std::bind1st (comparison(), key));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@@ -232,14 +232,14 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
BOOST_DEDUCED_TYPENAME default_algorithms<ContainerTraits, Ovr>::size_type
|
||||
default_algorithms<ContainerTraits, Ovr>::get_index (
|
||||
default_algorithms<ContainerTraits, Ovr>::get_index(
|
||||
container &c, key_param key)
|
||||
{
|
||||
iterator found (most_derived::find (c, key));
|
||||
|
||||
if (found == most_derived::end(c))
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyErr_SetString(
|
||||
PyExc_ValueError, "get_index: element not found");
|
||||
|
||||
boost::python::throw_error_already_set ();
|
||||
@@ -255,16 +255,16 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
BOOST_DEDUCED_TYPENAME default_algorithms<ContainerTraits, Ovr>::size_type
|
||||
default_algorithms<ContainerTraits, Ovr>::count (
|
||||
default_algorithms<ContainerTraits, Ovr>::count(
|
||||
container &c, key_param key)
|
||||
{
|
||||
typedef typename container_traits::value_traits_ value_traits_;
|
||||
typedef typename value_traits_::equal_to comparison;
|
||||
|
||||
return std::count_if (
|
||||
most_derived::begin(c)
|
||||
, most_derived::end(c)
|
||||
, std::bind1st (comparison(), key));
|
||||
return std::count_if(
|
||||
most_derived::begin(c),
|
||||
most_derived::end(c),
|
||||
std::bind1st (comparison(), key));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@@ -273,7 +273,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
bool
|
||||
default_algorithms<ContainerTraits, Ovr>::contains (
|
||||
default_algorithms<ContainerTraits, Ovr>::contains(
|
||||
container &c, key_param key)
|
||||
{
|
||||
return most_derived::find (c, key) != most_derived::end(c);
|
||||
@@ -285,7 +285,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
BOOST_DEDUCED_TYPENAME default_algorithms<ContainerTraits, Ovr>::reference
|
||||
default_algorithms<ContainerTraits, Ovr>::get (
|
||||
default_algorithms<ContainerTraits, Ovr>::get(
|
||||
container &c, index_param ix)
|
||||
{
|
||||
return c[most_derived::bounds_check (c, ix, "get")];
|
||||
@@ -297,7 +297,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
void
|
||||
default_algorithms<ContainerTraits, Ovr>::assign (
|
||||
default_algorithms<ContainerTraits, Ovr>::assign(
|
||||
container &c, index_param ix, value_param val)
|
||||
{
|
||||
c[most_derived::bounds_check (c, ix, "assign")] = val;
|
||||
@@ -309,7 +309,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
void
|
||||
default_algorithms<ContainerTraits, Ovr>::push_back (
|
||||
default_algorithms<ContainerTraits, Ovr>::push_back(
|
||||
container &c, value_param v)
|
||||
{
|
||||
c.push_back (v);
|
||||
@@ -321,13 +321,13 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
void
|
||||
default_algorithms<ContainerTraits, Ovr>::insert (
|
||||
default_algorithms<ContainerTraits, Ovr>::insert(
|
||||
container &c, index_param i, value_param v)
|
||||
{
|
||||
iterator insert_pos (most_derived::begin(c));
|
||||
|
||||
// Index may range up to c.size() inclusive to allow inserting at end
|
||||
std::advance (
|
||||
std::advance(
|
||||
insert_pos, most_derived::bounds_check (c, i, "insert", true, true));
|
||||
|
||||
c.insert (insert_pos, v);
|
||||
@@ -339,7 +339,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
void
|
||||
default_algorithms<ContainerTraits, Ovr>::erase_range (
|
||||
default_algorithms<ContainerTraits, Ovr>::erase_range(
|
||||
container &c, index_param from, index_param to)
|
||||
{
|
||||
iterator start (most_derived::begin(c));
|
||||
@@ -362,7 +362,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
void
|
||||
default_algorithms<ContainerTraits, Ovr>::erase_one (
|
||||
default_algorithms<ContainerTraits, Ovr>::erase_one(
|
||||
container &c, index_param ix)
|
||||
{
|
||||
iterator iter (most_derived::begin(c));
|
||||
@@ -421,12 +421,12 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
void
|
||||
assoc_algorithms<ContainerTraits, Ovr>::erase_one (
|
||||
assoc_algorithms<ContainerTraits, Ovr>::erase_one(
|
||||
container &c, key_param key)
|
||||
{
|
||||
if (c.erase (key) == 0)
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyErr_SetString(
|
||||
PyExc_ValueError, "Container does not hold value to be erased");
|
||||
|
||||
boost::python::throw_error_already_set ();
|
||||
@@ -451,7 +451,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
bool
|
||||
assoc_algorithms<ContainerTraits, Ovr>::contains (
|
||||
assoc_algorithms<ContainerTraits, Ovr>::contains(
|
||||
container &c, key_param key)
|
||||
{
|
||||
return most_derived::find (c, key) != most_derived::end(c);
|
||||
@@ -464,14 +464,14 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
BOOST_DEDUCED_TYPENAME assoc_algorithms<ContainerTraits, Ovr>::iterator
|
||||
assoc_algorithms<ContainerTraits, Ovr>::find_or_throw (
|
||||
assoc_algorithms<ContainerTraits, Ovr>::find_or_throw(
|
||||
container &c, index_param ix)
|
||||
{
|
||||
iterator iter = most_derived::find (c, ix);
|
||||
|
||||
if (iter == most_derived::end(c))
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyErr_SetString(
|
||||
PyExc_ValueError, "associative container: key not found");
|
||||
|
||||
boost::python::throw_error_already_set ();
|
||||
@@ -486,7 +486,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
BOOST_DEDUCED_TYPENAME assoc_algorithms<ContainerTraits, Ovr>::size_type
|
||||
assoc_algorithms<ContainerTraits, Ovr>::count (
|
||||
assoc_algorithms<ContainerTraits, Ovr>::count(
|
||||
container &c, key_param key)
|
||||
{
|
||||
return c.count (key);
|
||||
|
||||
@@ -91,9 +91,9 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class Container
|
||||
, class Holder = identity<Container>
|
||||
, class Generator = vector_generator>
|
||||
template<class Container,
|
||||
class Holder = identity<Container>,
|
||||
class Generator = vector_generator>
|
||||
class container_proxy
|
||||
{
|
||||
typedef container_proxy<Container, Holder, Generator> self_type;
|
||||
@@ -122,16 +122,16 @@ namespace boost { namespace python { namespace indexing {
|
||||
typedef const_element_proxy<self_type> const_value_type;
|
||||
typedef const_value_type const_reference; // Ref. semantics
|
||||
|
||||
typedef proxy_iterator <self_type, value_type, raw_iterator_traits
|
||||
, size_type, raw_iterator> iterator;
|
||||
typedef proxy_iterator <self_type, value_type, raw_iterator_traits,
|
||||
size_type, raw_iterator> iterator;
|
||||
typedef iterator const_iterator; // No const_iterator yet implemented
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
template<typename Iter> container_proxy (Iter start, Iter finish)
|
||||
// Define inline for MSVC6 compatibility
|
||||
: m_held_obj (Holder::create())
|
||||
, m_proxies ()
|
||||
: m_held_obj (Holder::create()),
|
||||
m_proxies ()
|
||||
{
|
||||
insert (begin(), start, finish);
|
||||
}
|
||||
@@ -220,10 +220,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
try
|
||||
{
|
||||
// Insert the new element(s) into the real container (could throw)
|
||||
raw_container().insert (
|
||||
raw_container().begin() + iter.index
|
||||
, from
|
||||
, to);
|
||||
raw_container().insert(
|
||||
raw_container().begin() + iter.index,
|
||||
from,
|
||||
to);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -233,9 +233,9 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
catch (...)
|
||||
{
|
||||
raw_container().erase (
|
||||
raw_container().begin() + iter.index
|
||||
, raw_container().begin() + iter.index + count);
|
||||
raw_container().erase(
|
||||
raw_container().begin() + iter.index,
|
||||
raw_container().begin() + iter.index + count);
|
||||
|
||||
throw;
|
||||
}
|
||||
@@ -243,18 +243,18 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
catch (...)
|
||||
{
|
||||
m_proxies.erase (
|
||||
m_proxies.begin() + iter.index
|
||||
, m_proxies.begin() + iter.index + count);
|
||||
m_proxies.erase(
|
||||
m_proxies.begin() + iter.index,
|
||||
m_proxies.begin() + iter.index + count);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
// Adjust any proxies after the inserted elements (nothrow)
|
||||
adjust_proxies (
|
||||
m_proxies.begin() + iter.index + count
|
||||
, m_proxies.end()
|
||||
, static_cast<difference_type> (count));
|
||||
adjust_proxies(
|
||||
m_proxies.begin() + iter.index + count,
|
||||
m_proxies.end(),
|
||||
static_cast<difference_type> (count));
|
||||
}
|
||||
|
||||
template<typename Iter>
|
||||
@@ -302,8 +302,8 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<class Container, class Holder, class Generator>
|
||||
container_proxy<Container, Holder, Generator>
|
||||
::container_proxy ()
|
||||
: m_held_obj (Holder::create())
|
||||
, m_proxies ()
|
||||
: m_held_obj (Holder::create()),
|
||||
m_proxies ()
|
||||
{
|
||||
// Container is empty - no further processing
|
||||
}
|
||||
@@ -311,8 +311,8 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<class Container, class Holder, class Generator>
|
||||
container_proxy<Container, Holder, Generator>
|
||||
::container_proxy (held_type const &held)
|
||||
: m_held_obj (Holder::copy (held))
|
||||
, m_proxies (size())
|
||||
: m_held_obj (Holder::copy (held)),
|
||||
m_proxies (size())
|
||||
{
|
||||
write_proxies (0, size());
|
||||
}
|
||||
@@ -320,8 +320,8 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<class Container, class Holder, class Generator>
|
||||
container_proxy<Container, Holder, Generator>
|
||||
::container_proxy (container_proxy const ©)
|
||||
: m_held_obj (Holder::copy (copy.m_held_obj))
|
||||
, m_proxies (size())
|
||||
: m_held_obj (Holder::copy (copy.m_held_obj)),
|
||||
m_proxies (size())
|
||||
{
|
||||
write_proxies (0, size()); // Create our own proxies for the copied values
|
||||
}
|
||||
@@ -454,7 +454,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<class Container, class Holder, class Generator>
|
||||
BOOST_DEDUCED_TYPENAME container_proxy<Container, Holder, Generator>::iterator
|
||||
container_proxy<Container, Holder, Generator>::erase (
|
||||
container_proxy<Container, Holder, Generator>::erase(
|
||||
iterator from, iterator to)
|
||||
{
|
||||
assert (from.ptr == this);
|
||||
@@ -465,16 +465,16 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
// Erase the elements from the real container
|
||||
raw_iterator result
|
||||
= raw_container().erase (
|
||||
raw_container().begin() + from.index
|
||||
, raw_container().begin() + to.index);
|
||||
= raw_container().erase(
|
||||
raw_container().begin() + from.index,
|
||||
raw_container().begin() + to.index);
|
||||
|
||||
return iterator (this, result);
|
||||
}
|
||||
|
||||
template<class Container, class Holder, class Generator>
|
||||
BOOST_DEDUCED_TYPENAME container_proxy<Container, Holder, Generator>::iterator
|
||||
container_proxy<Container, Holder, Generator>::insert (
|
||||
container_proxy<Container, Holder, Generator>::insert(
|
||||
iterator iter, raw_value_type const ©)
|
||||
{
|
||||
// Use the iterator-based version by treating the value as an
|
||||
@@ -485,7 +485,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
|
||||
template<class Container, class Holder, class Generator>
|
||||
bool container_proxy<Container, Holder, Generator>::clear_proxy (
|
||||
bool container_proxy<Container, Holder, Generator>::clear_proxy(
|
||||
pointer_impl &ptr)
|
||||
{
|
||||
// Warning - this can break the class invariant. Use only when the
|
||||
@@ -509,7 +509,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
|
||||
template<class Container, class Holder, class Generator>
|
||||
void container_proxy<Container, Holder, Generator>::clear_proxies (
|
||||
void container_proxy<Container, Holder, Generator>::clear_proxies(
|
||||
size_type from_index, size_type to_index)
|
||||
{
|
||||
while (from_index != to_index)
|
||||
@@ -535,7 +535,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
|
||||
template<class Container, class Holder, class Generator>
|
||||
void container_proxy<Container, Holder, Generator>::detach_proxies (
|
||||
void container_proxy<Container, Holder, Generator>::detach_proxies(
|
||||
size_type from_index, size_type to_index)
|
||||
{
|
||||
while (from_index != to_index)
|
||||
@@ -564,12 +564,12 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
|
||||
template<class Container, class Holder, class Generator>
|
||||
void container_proxy<Container, Holder, Generator>::notify_insertion (
|
||||
void container_proxy<Container, Holder, Generator>::notify_insertion(
|
||||
size_type from_index, size_type to_index)
|
||||
{
|
||||
size_type count = to_index - from_index;
|
||||
|
||||
m_proxies.insert (
|
||||
m_proxies.insert(
|
||||
m_proxies.begin() + from_index, count, pointer_impl());
|
||||
|
||||
try
|
||||
@@ -579,25 +579,25 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
catch (...)
|
||||
{
|
||||
m_proxies.erase (
|
||||
m_proxies.begin() + from_index
|
||||
, m_proxies.begin() + to_index);
|
||||
m_proxies.erase(
|
||||
m_proxies.begin() + from_index,
|
||||
m_proxies.begin() + to_index);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
// Adjust any proxies after the inserted elements (nothrow)
|
||||
adjust_proxies (
|
||||
m_proxies.begin() + to_index
|
||||
, m_proxies.end()
|
||||
, static_cast<difference_type> (count));
|
||||
adjust_proxies(
|
||||
m_proxies.begin() + to_index,
|
||||
m_proxies.end(),
|
||||
static_cast<difference_type> (count));
|
||||
}
|
||||
|
||||
template<class Container, class Holder, class Generator>
|
||||
void container_proxy<Container, Holder, Generator>::adjust_proxies (
|
||||
pointer_iterator from
|
||||
, pointer_iterator to
|
||||
, difference_type offset)
|
||||
void container_proxy<Container, Holder, Generator>::adjust_proxies(
|
||||
pointer_iterator from,
|
||||
pointer_iterator to,
|
||||
difference_type offset)
|
||||
{
|
||||
while (from != to)
|
||||
{
|
||||
@@ -607,7 +607,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
|
||||
template<class Container, class Holder, class Generator>
|
||||
void container_proxy<Container, Holder, Generator>::write_proxies (
|
||||
void container_proxy<Container, Holder, Generator>::write_proxies(
|
||||
size_type from, size_type to)
|
||||
{
|
||||
// (over)write proxy pointers in the given range. Re-uses existing
|
||||
@@ -718,10 +718,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
};
|
||||
}
|
||||
#endif
|
||||
template <
|
||||
class Container
|
||||
, int Flags = 0
|
||||
, class Traits = container_proxy_traits<Container>
|
||||
template<
|
||||
class Container,
|
||||
int Flags = 0,
|
||||
class Traits = container_proxy_traits<Container>
|
||||
>
|
||||
struct container_proxy_suite
|
||||
: container_suite<Container, Flags, default_algorithms<Traits> >
|
||||
|
||||
@@ -29,10 +29,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
typedef boost::python::return_value_policy<boost::python::return_by_value>
|
||||
default_container_policies;
|
||||
|
||||
template <
|
||||
class Container
|
||||
, int Flags = 0
|
||||
, class Algorithms
|
||||
template<
|
||||
class Container,
|
||||
int Flags = 0,
|
||||
class Algorithms
|
||||
= algo_selector<Container>
|
||||
>
|
||||
struct container_suite
|
||||
|
||||
@@ -55,24 +55,24 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename Container, typename ValueTraits = detail::no_override>
|
||||
struct base_container_traits
|
||||
: public ::boost::python::indexing::iterator_traits <
|
||||
BOOST_DEDUCED_TYPENAME mpl::if_ <
|
||||
is_const<Container>
|
||||
, BOOST_DEDUCED_TYPENAME Container::const_iterator
|
||||
, BOOST_DEDUCED_TYPENAME Container::iterator
|
||||
: public ::boost::python::indexing::iterator_traits<
|
||||
BOOST_DEDUCED_TYPENAME mpl::if_<
|
||||
is_const<Container>,
|
||||
BOOST_DEDUCED_TYPENAME Container::const_iterator,
|
||||
BOOST_DEDUCED_TYPENAME Container::iterator
|
||||
>::type
|
||||
>
|
||||
{
|
||||
protected:
|
||||
typedef ::boost::python::indexing::iterator_traits <
|
||||
BOOST_DEDUCED_TYPENAME mpl::if_ <
|
||||
is_const<Container>
|
||||
, BOOST_DEDUCED_TYPENAME Container::const_iterator
|
||||
, BOOST_DEDUCED_TYPENAME Container::iterator
|
||||
typedef ::boost::python::indexing::iterator_traits<
|
||||
BOOST_DEDUCED_TYPENAME mpl::if_<
|
||||
is_const<Container>,
|
||||
BOOST_DEDUCED_TYPENAME Container::const_iterator,
|
||||
BOOST_DEDUCED_TYPENAME Container::iterator
|
||||
>::type
|
||||
> base_type;
|
||||
|
||||
BOOST_STATIC_CONSTANT (
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, is_mutable = ! boost::is_const<Container>::value);
|
||||
|
||||
public:
|
||||
@@ -96,14 +96,14 @@ namespace boost { namespace python { namespace indexing {
|
||||
// second (optional) template parameter
|
||||
typedef value_traits<typename base_type::value_type> default_value_traits;
|
||||
|
||||
typedef typename detail::maybe_override <
|
||||
typedef typename detail::maybe_override<
|
||||
default_value_traits, ValueTraits>::type value_traits_;
|
||||
|
||||
BOOST_STATIC_CONSTANT (
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, has_mutable_ref
|
||||
= ICE_AND (base_type::has_mutable_ref, is_mutable));
|
||||
|
||||
BOOST_STATIC_CONSTANT (
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, has_find = value_traits_::equality_comparable);
|
||||
|
||||
// Assume the worst for everything else
|
||||
|
||||
@@ -46,10 +46,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
#endif
|
||||
|
||||
template <
|
||||
class Container
|
||||
, int Flags = 0
|
||||
, class Traits = default_sequence_traits<Container>
|
||||
template<
|
||||
class Container,
|
||||
int Flags = 0,
|
||||
class Traits = default_sequence_traits<Container>
|
||||
>
|
||||
struct deque_suite
|
||||
: container_suite<Container, Flags, default_algorithms<Traits> >
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
namespace boost { namespace python { namespace indexing {
|
||||
template<typename ContainerProxy>
|
||||
struct element_proxy_traits
|
||||
: public value_traits <
|
||||
: public value_traits<
|
||||
BOOST_DEDUCED_TYPENAME ContainerProxy::raw_value_type>
|
||||
{
|
||||
typedef element_proxy<ContainerProxy> element_proxy_;
|
||||
@@ -44,7 +44,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
{
|
||||
typename base_type::less m_base_compare;
|
||||
|
||||
bool operator() (
|
||||
bool operator()(
|
||||
element_proxy_ const &p1, element_proxy_ const &p2) const
|
||||
{
|
||||
return m_base_compare (*p1, *p2);
|
||||
@@ -59,7 +59,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
typename base_type::equal_to m_base_compare;
|
||||
|
||||
bool operator() (
|
||||
bool operator()(
|
||||
raw_value_type const &v, element_proxy_ const &p) const
|
||||
{
|
||||
return m_base_compare (v, *p);
|
||||
|
||||
@@ -58,9 +58,9 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<typename Algorithms, typename SliceType>
|
||||
int_slice_helper<Algorithms, SliceType>
|
||||
::int_slice_helper (container &c, slice_type const &sl)
|
||||
: m_slice (sl)
|
||||
, m_ptr (&c)
|
||||
, m_pos (-1)
|
||||
: m_slice (sl),
|
||||
m_ptr (&c),
|
||||
m_pos (-1)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
namespace detail {
|
||||
template<bool doit> struct maybe_insert {
|
||||
template<class Algorithms>
|
||||
static void apply (
|
||||
static void apply(
|
||||
# if defined (BOOST_NO_MEMBER_TEMPLATES) \
|
||||
&& defined (BOOST_MSVC6_MEMBER_TEMPLATES)
|
||||
// Can't explicitly instantiate member function - must let
|
||||
@@ -125,13 +125,13 @@ namespace boost { namespace python { namespace indexing {
|
||||
// parameter. Same applies throughout
|
||||
Algorithms *,
|
||||
# endif
|
||||
typename Algorithms::container &
|
||||
, typename Algorithms::index_param
|
||||
, typename Algorithms::value_param)
|
||||
typename Algorithms::container &,
|
||||
typename Algorithms::index_param,
|
||||
typename Algorithms::value_param)
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyExc_TypeError
|
||||
, "container does not support insertion into slice");
|
||||
PyErr_SetString(
|
||||
PyExc_TypeError,
|
||||
"container does not support insertion into slice");
|
||||
|
||||
boost::python::throw_error_already_set ();
|
||||
}
|
||||
@@ -139,14 +139,14 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<> struct maybe_insert<true> {
|
||||
template<class Algorithms>
|
||||
static void apply (
|
||||
static void apply(
|
||||
# if defined (BOOST_NO_MEMBER_TEMPLATES) \
|
||||
&& defined (BOOST_MSVC6_MEMBER_TEMPLATES)
|
||||
Algorithms *,
|
||||
# endif
|
||||
typename Algorithms::container &c
|
||||
, typename Algorithms::index_param i
|
||||
, typename Algorithms::value_param v)
|
||||
typename Algorithms::container &c,
|
||||
typename Algorithms::index_param i,
|
||||
typename Algorithms::value_param v)
|
||||
{
|
||||
Algorithms::insert (c, i, v);
|
||||
}
|
||||
@@ -158,7 +158,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
{
|
||||
if (m_slice.step() != 1)
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyErr_SetString(
|
||||
PyExc_ValueError, "attempt to insert via extended slice");
|
||||
|
||||
boost::python::throw_error_already_set ();
|
||||
@@ -171,7 +171,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
&& defined (BOOST_MSVC6_MEMBER_TEMPLATES)
|
||||
apply (static_cast<Algorithms *>(0),
|
||||
# else
|
||||
BOOST_NESTED_TEMPLATE apply <Algorithms> (
|
||||
BOOST_NESTED_TEMPLATE apply <Algorithms>(
|
||||
# endif
|
||||
*m_ptr, m_pos, val);
|
||||
|
||||
@@ -182,16 +182,16 @@ namespace boost { namespace python { namespace indexing {
|
||||
namespace detail {
|
||||
template<bool doit> struct maybe_erase {
|
||||
template<class Algorithms>
|
||||
static void apply (
|
||||
static void apply(
|
||||
# if defined (BOOST_NO_MEMBER_TEMPLATES) \
|
||||
&& defined (BOOST_MSVC6_MEMBER_TEMPLATES)
|
||||
Algorithms *,
|
||||
# endif
|
||||
typename Algorithms::container &
|
||||
, typename Algorithms::index_param
|
||||
, typename Algorithms::index_param)
|
||||
typename Algorithms::container &,
|
||||
typename Algorithms::index_param,
|
||||
typename Algorithms::index_param)
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyErr_SetString(
|
||||
PyExc_TypeError, "container does not support item deletion");
|
||||
|
||||
boost::python::throw_error_already_set ();
|
||||
@@ -200,14 +200,14 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<> struct maybe_erase<true> {
|
||||
template<class Algorithms>
|
||||
static void apply (
|
||||
static void apply(
|
||||
# if defined (BOOST_NO_MEMBER_TEMPLATES) \
|
||||
&& defined (BOOST_MSVC6_MEMBER_TEMPLATES)
|
||||
Algorithms *,
|
||||
# endif
|
||||
typename Algorithms::container &c
|
||||
, typename Algorithms::index_param from
|
||||
, typename Algorithms::index_param to)
|
||||
typename Algorithms::container &c,
|
||||
typename Algorithms::index_param from,
|
||||
typename Algorithms::index_param to)
|
||||
{
|
||||
Algorithms::erase_range (c, from, to);
|
||||
}
|
||||
@@ -219,7 +219,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
{
|
||||
if (m_slice.step() != 1)
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyErr_SetString(
|
||||
PyExc_ValueError, "attempt to delete via extended slice");
|
||||
|
||||
boost::python::throw_error_already_set ();
|
||||
@@ -233,7 +233,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
&& defined (BOOST_MSVC6_MEMBER_TEMPLATES)
|
||||
apply (static_cast<Algorithms *>(0),
|
||||
# else
|
||||
BOOST_NESTED_TEMPLATE apply <Algorithms> (
|
||||
BOOST_NESTED_TEMPLATE apply <Algorithms>(
|
||||
# endif
|
||||
*m_ptr, m_pos, m_slice.stop());
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<typename T> iterator_range<T *> make_iterator_range (T *, T*);
|
||||
|
||||
#if !BOOST_WORKAROUND (BOOST_MSVC, <= 1200)
|
||||
template<typename T, std::size_t N> iterator_range<T *> make_iterator_range (
|
||||
template<typename T, std::size_t N> iterator_range<T *> make_iterator_range(
|
||||
T (&array)[N]);
|
||||
|
||||
template<typename T, std::size_t N> T *begin (T (&array)[N]);
|
||||
@@ -97,18 +97,18 @@ namespace boost { namespace python { namespace indexing {
|
||||
#endif
|
||||
|
||||
template<typename Iterator>
|
||||
iterator_range<Iterator>::iterator_range (
|
||||
iterator_range<Iterator>::iterator_range(
|
||||
iterator_param begin, iterator_param end)
|
||||
: m_begin (begin)
|
||||
, m_end (end)
|
||||
: m_begin (begin),
|
||||
m_end (end)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename Iterator>
|
||||
iterator_range<Iterator>
|
||||
::iterator_range (std::pair<iterator, iterator> const &pair)
|
||||
: m_begin (pair.first)
|
||||
, m_end (pair.second)
|
||||
: m_begin (pair.first),
|
||||
m_end (pair.second)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -201,10 +201,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
#endif
|
||||
|
||||
template <
|
||||
class Container
|
||||
, int Flags = 0
|
||||
, class Traits = base_container_traits<Container>
|
||||
template<
|
||||
class Container,
|
||||
int Flags = 0,
|
||||
class Traits = base_container_traits<Container>
|
||||
>
|
||||
struct iterator_range_suite
|
||||
: container_suite<Container, Flags, default_algorithms<Traits> >
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
BOOST_STATIC_CONSTANT (bool, has_copyable_iter = false);
|
||||
BOOST_STATIC_CONSTANT (bool, is_reorderable = false);
|
||||
BOOST_STATIC_CONSTANT (
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, has_mutable_ref = is_mutable_ref<reference>::value);
|
||||
|
||||
BOOST_STATIC_CONSTANT (index_style_t, index_style = index_style_none);
|
||||
|
||||
@@ -37,8 +37,8 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<typename ContainerTraits, typename Ovr = detail::no_override>
|
||||
class list_algorithms
|
||||
: public default_algorithms
|
||||
<ContainerTraits
|
||||
, typename detail::maybe_override
|
||||
<ContainerTraits,
|
||||
typename detail::maybe_override
|
||||
<list_algorithms<ContainerTraits, Ovr>, Ovr>
|
||||
::type>
|
||||
{
|
||||
@@ -76,10 +76,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
#endif
|
||||
|
||||
template <
|
||||
class Container
|
||||
, int Flags = 0
|
||||
, class Traits = default_sequence_traits<Container>
|
||||
template<
|
||||
class Container,
|
||||
int Flags = 0,
|
||||
class Traits = default_sequence_traits<Container>
|
||||
>
|
||||
struct list_suite
|
||||
: container_suite<Container, Flags, list_algorithms<Traits> >
|
||||
@@ -111,7 +111,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
// provided that value_traits_::less is std::less<value_type>. It
|
||||
// would be possible to support std::greater<T> (the only other
|
||||
// overload of list::sort in MSVC6) with some additional work.
|
||||
BOOST_STATIC_ASSERT (
|
||||
BOOST_STATIC_ASSERT(
|
||||
(::boost::is_same<comparison, std::less<value_type> >::value));
|
||||
c.sort ();
|
||||
#else
|
||||
|
||||
@@ -66,8 +66,8 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<typename ContainerTraits, typename Ovr = detail::no_override>
|
||||
class map_algorithms
|
||||
: public assoc_algorithms
|
||||
<ContainerTraits
|
||||
, typename detail::maybe_override
|
||||
<ContainerTraits,
|
||||
typename detail::maybe_override
|
||||
<map_algorithms<ContainerTraits, Ovr>, Ovr>
|
||||
::type>
|
||||
{
|
||||
@@ -126,10 +126,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
#endif
|
||||
|
||||
template <
|
||||
class Container
|
||||
, int Flags = 0
|
||||
, class Traits = map_traits<Container>
|
||||
template<
|
||||
class Container,
|
||||
int Flags = 0,
|
||||
class Traits = map_traits<Container>
|
||||
>
|
||||
struct map_suite
|
||||
: container_suite<Container, Flags, map_algorithms<Traits> >
|
||||
@@ -153,7 +153,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
void
|
||||
map_algorithms<ContainerTraits, Ovr>::assign (
|
||||
map_algorithms<ContainerTraits, Ovr>::assign(
|
||||
container &c, index_param ix, value_param val)
|
||||
{
|
||||
c[ix] = val; // Handles overwrite and insert
|
||||
@@ -166,19 +166,19 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
void
|
||||
map_algorithms<ContainerTraits, Ovr>::insert (
|
||||
map_algorithms<ContainerTraits, Ovr>::insert(
|
||||
container &c, index_param ix, value_param val)
|
||||
{
|
||||
typedef std::pair
|
||||
<BOOST_DEDUCED_TYPENAME self_type::container_traits::index_type
|
||||
, BOOST_DEDUCED_TYPENAME self_type::container_traits::value_type>
|
||||
<BOOST_DEDUCED_TYPENAME self_type::container_traits::index_type,
|
||||
BOOST_DEDUCED_TYPENAME self_type::container_traits::value_type>
|
||||
pair_type;
|
||||
|
||||
// Can't use std::make_pair, because param types may be references
|
||||
|
||||
if (!c.insert (pair_type (ix, val)).second)
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyErr_SetString(
|
||||
PyExc_ValueError, "Map already holds value for insertion");
|
||||
|
||||
boost::python::throw_error_already_set ();
|
||||
|
||||
@@ -24,27 +24,27 @@
|
||||
|
||||
namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template <class ContainerProxy, typename ElementProxy, typename Traits
|
||||
, typename Size, typename Iter>
|
||||
template <class ContainerProxy, typename ElementProxy, typename Traits,
|
||||
typename Size, typename Iter>
|
||||
class proxy_iterator
|
||||
: public boost::iterator <
|
||||
std::random_access_iterator_tag
|
||||
, ElementProxy
|
||||
, typename Traits::difference_type
|
||||
, ElementProxy *
|
||||
, ElementProxy // Already has reference semantics
|
||||
: public boost::iterator<
|
||||
std::random_access_iterator_tag,
|
||||
ElementProxy,
|
||||
typename Traits::difference_type,
|
||||
ElementProxy *,
|
||||
ElementProxy // Already has reference semantics
|
||||
>
|
||||
{
|
||||
#if !defined (BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
template<class C, class H, class G> friend class container_proxy;
|
||||
#endif
|
||||
|
||||
typedef boost::iterator <
|
||||
std::random_access_iterator_tag
|
||||
, ElementProxy
|
||||
, typename Traits::difference_type
|
||||
, ElementProxy *
|
||||
, ElementProxy
|
||||
typedef boost::iterator<
|
||||
std::random_access_iterator_tag,
|
||||
ElementProxy,
|
||||
typename Traits::difference_type,
|
||||
ElementProxy *,
|
||||
ElementProxy
|
||||
> base_type;
|
||||
|
||||
public:
|
||||
@@ -148,9 +148,9 @@ namespace boost { namespace python { namespace indexing {
|
||||
// MSVC7.0 can't decide between this and the unspecialized version
|
||||
namespace std {
|
||||
template <class C, typename E, typename T, typename S, typename I>
|
||||
void iter_swap (
|
||||
boost::python::indexing::proxy_iterator<C, E, T, S, I> const &first
|
||||
, boost::python::indexing::proxy_iterator<C, E, T, S, I> const &second)
|
||||
void iter_swap(
|
||||
boost::python::indexing::proxy_iterator<C, E, T, S, I> const &first,
|
||||
boost::python::indexing::proxy_iterator<C, E, T, S, I> const &second)
|
||||
{
|
||||
first.iter_swap (second);
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<typename ContainerTraits, typename Ovr = detail::no_override>
|
||||
class set_algorithms
|
||||
: public assoc_algorithms
|
||||
<ContainerTraits
|
||||
, typename detail::maybe_override
|
||||
<ContainerTraits,
|
||||
typename detail::maybe_override
|
||||
<set_algorithms<ContainerTraits, Ovr>, Ovr>
|
||||
::type>
|
||||
{
|
||||
@@ -114,10 +114,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
#endif
|
||||
|
||||
template <
|
||||
class Container
|
||||
, int Flags = 0
|
||||
, class Traits = set_traits<Container>
|
||||
template<
|
||||
class Container,
|
||||
int Flags = 0,
|
||||
class Traits = set_traits<Container>
|
||||
>
|
||||
struct set_suite
|
||||
: container_suite<Container, Flags, set_algorithms<Traits> >
|
||||
@@ -130,12 +130,12 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
template<typename ContainerTraits, typename Ovr>
|
||||
void
|
||||
set_algorithms<ContainerTraits, Ovr>::insert (
|
||||
set_algorithms<ContainerTraits, Ovr>::insert(
|
||||
container &c, index_param ix)
|
||||
{
|
||||
if (!c.insert (ix).second)
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyErr_SetString(
|
||||
PyExc_ValueError, "Set already holds value for insertion");
|
||||
|
||||
boost::python::throw_error_already_set ();
|
||||
|
||||
@@ -67,19 +67,19 @@ namespace boost { namespace python { namespace indexing {
|
||||
};
|
||||
|
||||
template<class ContainerProxy>
|
||||
shared_proxy_impl<ContainerProxy>::shared_proxy_impl (ContainerProxy *owner
|
||||
, size_t index)
|
||||
: m_owner_ptr (owner)
|
||||
, m_index (index)
|
||||
, m_element_ptr ()
|
||||
shared_proxy_impl<ContainerProxy>::shared_proxy_impl (ContainerProxy *owner,
|
||||
size_t index)
|
||||
: m_owner_ptr (owner),
|
||||
m_index (index),
|
||||
m_element_ptr ()
|
||||
{
|
||||
}
|
||||
|
||||
template<class ContainerProxy>
|
||||
shared_proxy_impl<ContainerProxy>::shared_proxy_impl (value_type const &val)
|
||||
: m_owner_ptr (0)
|
||||
, m_index (static_cast<size_t>(-1))
|
||||
, m_element_ptr (new value_type (val))
|
||||
: m_owner_ptr (0),
|
||||
m_index (static_cast<size_t>(-1)),
|
||||
m_element_ptr (new value_type (val))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<class ContainerProxy>
|
||||
void shared_proxy_impl<ContainerProxy>::detach ()
|
||||
{
|
||||
BOOST_PYTHON_INDEXING_RESET_AUTO_PTR (
|
||||
BOOST_PYTHON_INDEXING_RESET_AUTO_PTR(
|
||||
m_element_ptr, new value_type (**this));
|
||||
m_owner_ptr = 0;
|
||||
m_index = static_cast<size_t>(-1);
|
||||
|
||||
@@ -78,7 +78,7 @@ boost::python::indexing::slice::slice (T const &ref)
|
||||
{
|
||||
if (!PySlice_Check (this->ptr()))
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyErr_SetString(
|
||||
PyExc_TypeError, "slice constructor: passed a non-slice object");
|
||||
|
||||
boost::python::throw_error_already_set();
|
||||
@@ -90,7 +90,7 @@ namespace boost { namespace python { namespace converter {
|
||||
// Specialized converter to handle PySlice_Type objects
|
||||
template<>
|
||||
struct object_manager_traits<boost::python::indexing::slice>
|
||||
: pytype_object_manager_traits <
|
||||
: pytype_object_manager_traits<
|
||||
&PySlice_Type, ::boost::python::indexing::slice>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
::make_getitem (Policy const &policy)
|
||||
{
|
||||
return
|
||||
boost::python::make_function (
|
||||
boost::python::make_function(
|
||||
get_slice, detail::postcall_override<Policy> (policy));
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
|
||||
if (!read_ptr.get())
|
||||
{
|
||||
PyErr_SetString (
|
||||
PyErr_SetString(
|
||||
PyExc_TypeError, "Type assigned to slice must be a sequence");
|
||||
|
||||
boost::python::throw_error_already_set();
|
||||
@@ -219,10 +219,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
// a reference to existing object, if possible and sensible) and the
|
||||
// second allowing implicit conversions.
|
||||
|
||||
typedef boost::python::extract <
|
||||
typedef boost::python::extract<
|
||||
BOOST_DEDUCED_TYPENAME Algorithms::value_param> extractor1;
|
||||
|
||||
typedef boost::python::extract <
|
||||
typedef boost::python::extract<
|
||||
BOOST_DEDUCED_TYPENAME Algorithms::value_type> extractor2;
|
||||
|
||||
// Note: any error during this operation will probably leave the
|
||||
@@ -294,9 +294,9 @@ namespace boost { namespace python { namespace indexing {
|
||||
slice sl
|
||||
((boost::python::handle<>
|
||||
(PySlice_New
|
||||
(length.ptr()
|
||||
, boost::python::object().ptr()
|
||||
, boost::python::object().ptr()))));
|
||||
(length.ptr(),
|
||||
boost::python::object().ptr(),
|
||||
boost::python::object().ptr()))));
|
||||
|
||||
set_slice (c, sl, values);
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ namespace boost { namespace python { namespace indexing {
|
||||
index_style_t const index_style_linear = 2;
|
||||
#else
|
||||
enum index_style_t {
|
||||
index_style_none // No random access (iteration only)
|
||||
, index_style_nonlinear // Random access by key (no slicing)
|
||||
, index_style_linear // Random access by integer index (allows slicing)
|
||||
index_style_none, // No random access (iteration only)
|
||||
index_style_nonlinear, // Random access by key (no slicing)
|
||||
index_style_linear // Random access by integer index (allows slicing)
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
}
|
||||
#endif
|
||||
|
||||
template <
|
||||
class Container
|
||||
, int Flags = 0
|
||||
, class Traits = default_sequence_traits<Container>
|
||||
template<
|
||||
class Container,
|
||||
int Flags = 0,
|
||||
class Traits = default_sequence_traits<Container>
|
||||
>
|
||||
struct vector_suite
|
||||
: container_suite<Container, Flags, default_algorithms<Traits> >
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
|
||||
namespace boost { namespace python { namespace indexing {
|
||||
enum visitor_flags {
|
||||
disable_len = 1
|
||||
, disable_slices = 2
|
||||
, disable_search = 4
|
||||
, disable_reorder = 8
|
||||
, disable_extend = 16
|
||||
, disable_insert = 32
|
||||
, minimum_support = 0xffff // Disable all optional features
|
||||
disable_len = 1,
|
||||
disable_slices = 2,
|
||||
disable_search = 4,
|
||||
disable_reorder = 8,
|
||||
disable_extend = 16,
|
||||
disable_insert = 32,
|
||||
minimum_support = 0xffff // Disable all optional features
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
@@ -77,10 +77,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_len<true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("__len__", &Algorithms::size, policy);
|
||||
}
|
||||
@@ -103,10 +103,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_getitem<true, false> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("__getitem__", &Algorithms::get, policy);
|
||||
}
|
||||
@@ -119,15 +119,15 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_getitem<true, true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("__getitem__", &Algorithms::get, policy);
|
||||
pyClass.def (
|
||||
"__getitem__"
|
||||
, slice_handler<Algorithms, Policy>::make_getitem (policy));
|
||||
pyClass.def(
|
||||
"__getitem__",
|
||||
slice_handler<Algorithms, Policy>::make_getitem (policy));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -148,10 +148,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_setitem<true, false> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("__setitem__", &Algorithms::assign, policy);
|
||||
}
|
||||
@@ -164,15 +164,15 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_setitem<true, true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("__setitem__", &Algorithms::assign, policy);
|
||||
pyClass.def (
|
||||
"__setitem__"
|
||||
, slice_handler<Algorithms, Policy>::make_setitem (policy));
|
||||
pyClass.def(
|
||||
"__setitem__",
|
||||
slice_handler<Algorithms, Policy>::make_setitem (policy));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -193,10 +193,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_delitem<true, false> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("__delitem__", &Algorithms::erase_one, policy);
|
||||
}
|
||||
@@ -209,15 +209,15 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_delitem<true, true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("__delitem__", &Algorithms::erase_one, policy);
|
||||
pyClass.def (
|
||||
"__delitem__"
|
||||
, slice_handler<Algorithms, Policy>::make_delitem (policy));
|
||||
pyClass.def(
|
||||
"__delitem__",
|
||||
slice_handler<Algorithms, Policy>::make_delitem (policy));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -238,20 +238,20 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_iter<true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &)
|
||||
{
|
||||
// Should maybe separate precall and postcall portions of the
|
||||
// policy (precall when generating the range object, postcall
|
||||
// when returing from range.next())?
|
||||
|
||||
pyClass.def (
|
||||
"__iter__"
|
||||
, boost::python::range<Policy> (
|
||||
Algorithms::begin
|
||||
, Algorithms::end));
|
||||
pyClass.def(
|
||||
"__iter__",
|
||||
boost::python::range<Policy>(
|
||||
Algorithms::begin,
|
||||
Algorithms::end));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -272,10 +272,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_sort<true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("sort", &Algorithms::sort, policy);
|
||||
}
|
||||
@@ -298,10 +298,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_reverse<true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("reverse", &Algorithms::reverse, policy);
|
||||
}
|
||||
@@ -324,10 +324,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_append<true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("append", &Algorithms::push_back, policy);
|
||||
}
|
||||
@@ -350,10 +350,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_insert<true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("insert", Algorithms::insert, policy);
|
||||
}
|
||||
@@ -376,14 +376,14 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_extend<true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def (
|
||||
"extend"
|
||||
, slice_handler<Algorithms, Policy>::make_extend (policy));
|
||||
pyClass.def(
|
||||
"extend",
|
||||
slice_handler<Algorithms, Policy>::make_extend (policy));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -404,10 +404,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_index<true> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("index", Algorithms::get_index, policy);
|
||||
}
|
||||
@@ -430,10 +430,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_count<true, index_style_none> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
pyClass.def ("count", Algorithms::count, policy);
|
||||
pyClass.def ("contains", Algorithms::contains, policy);
|
||||
@@ -448,10 +448,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_count<true, index_style_linear> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
// This is identical to the index_style_none version. Doing it
|
||||
// this way avoids using a partial specialization for
|
||||
@@ -468,10 +468,10 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<>
|
||||
struct maybe_add_count<true, index_style_nonlinear> {
|
||||
template<class PythonClass, class Algorithms, class Policy>
|
||||
static void apply (
|
||||
PythonClass &pyClass
|
||||
, Algorithms const &
|
||||
, Policy const &policy)
|
||||
static void apply(
|
||||
PythonClass &pyClass,
|
||||
Algorithms const &,
|
||||
Policy const &policy)
|
||||
{
|
||||
// Nearest equivalent is has_key, since Python dictionaries
|
||||
// have at most one value for a key.
|
||||
@@ -502,13 +502,13 @@ namespace boost { namespace python { namespace indexing {
|
||||
explicit visitor (Policy const &policy = Policy()) : m_policy (policy) { }
|
||||
|
||||
private:
|
||||
BOOST_STATIC_CONSTANT (
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, has_indexing = traits::index_style >= index_style_nonlinear);
|
||||
|
||||
BOOST_STATIC_CONSTANT (
|
||||
bool, has_slicing = ICE_AND (
|
||||
traits::index_style == index_style_linear
|
||||
, ICE_NOT (Flags & disable_slices)));
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, has_slicing = ICE_AND(
|
||||
traits::index_style == index_style_linear,
|
||||
ICE_NOT (Flags & disable_slices)));
|
||||
|
||||
public:
|
||||
template <class PythonClass>
|
||||
@@ -519,69 +519,69 @@ namespace boost { namespace python { namespace indexing {
|
||||
// Note - this will add __len__ for anything that can determine
|
||||
// its size, even if that might be inefficient (e.g. have linear
|
||||
// time complexity). Disable by setting disable_len in Flags
|
||||
maybe_add_len <
|
||||
ICE_AND (
|
||||
traits::has_copyable_iter
|
||||
, ICE_NOT (Flags & disable_len))
|
||||
maybe_add_len<
|
||||
ICE_AND(
|
||||
traits::has_copyable_iter,
|
||||
ICE_NOT (Flags & disable_len))
|
||||
>::apply (pyClass, algorithms(), precallPolicy);
|
||||
|
||||
maybe_add_getitem <has_indexing, has_slicing>
|
||||
::apply (pyClass, algorithms(), m_policy);
|
||||
|
||||
maybe_add_setitem <
|
||||
ICE_AND (traits::has_mutable_ref, has_indexing)
|
||||
, has_slicing
|
||||
maybe_add_setitem<
|
||||
ICE_AND (traits::has_mutable_ref, has_indexing),
|
||||
has_slicing
|
||||
>::apply (pyClass, algorithms(), m_policy);
|
||||
|
||||
maybe_add_delitem<ICE_AND (traits::has_erase, has_indexing), has_slicing>
|
||||
::apply (pyClass, algorithms(), m_policy);
|
||||
|
||||
maybe_add_iter<
|
||||
ICE_AND (
|
||||
traits::index_style != index_style_linear
|
||||
, traits::has_copyable_iter)
|
||||
ICE_AND(
|
||||
traits::index_style != index_style_linear,
|
||||
traits::has_copyable_iter)
|
||||
>::apply (pyClass, algorithms(), m_policy);
|
||||
|
||||
maybe_add_sort <
|
||||
ICE_AND (
|
||||
ICE_AND (
|
||||
traits::is_reorderable
|
||||
, value_traits_::lessthan_comparable)
|
||||
, ICE_NOT (Flags & disable_reorder))
|
||||
maybe_add_sort<
|
||||
ICE_AND(
|
||||
ICE_AND(
|
||||
traits::is_reorderable,
|
||||
value_traits_::lessthan_comparable),
|
||||
ICE_NOT (Flags & disable_reorder))
|
||||
>::apply (pyClass, algorithms(), precallPolicy);
|
||||
|
||||
maybe_add_reverse <
|
||||
maybe_add_reverse<
|
||||
ICE_AND (traits::is_reorderable, ICE_NOT (Flags & disable_reorder))
|
||||
>::apply (pyClass, algorithms(), precallPolicy);
|
||||
|
||||
maybe_add_append<traits::has_push_back>
|
||||
::apply (pyClass, algorithms(), precallPolicy);
|
||||
|
||||
maybe_add_insert <
|
||||
maybe_add_insert<
|
||||
ICE_AND (traits::has_insert, ICE_NOT (Flags & disable_insert))
|
||||
>::apply (pyClass, algorithms(), precallPolicy);
|
||||
|
||||
maybe_add_extend <
|
||||
ICE_AND (
|
||||
ICE_AND (
|
||||
traits::index_style == index_style_linear
|
||||
, traits::has_insert)
|
||||
, ICE_NOT (Flags & disable_extend))
|
||||
maybe_add_extend<
|
||||
ICE_AND(
|
||||
ICE_AND(
|
||||
traits::index_style == index_style_linear,
|
||||
traits::has_insert),
|
||||
ICE_NOT (Flags & disable_extend))
|
||||
>::apply (pyClass, algorithms(), precallPolicy);
|
||||
|
||||
maybe_add_index <
|
||||
ICE_AND (
|
||||
ICE_AND (
|
||||
traits::index_style == index_style_linear
|
||||
, traits::has_find)
|
||||
, ICE_NOT (Flags & disable_search))
|
||||
maybe_add_index<
|
||||
ICE_AND(
|
||||
ICE_AND(
|
||||
traits::index_style == index_style_linear,
|
||||
traits::has_find),
|
||||
ICE_NOT (Flags & disable_search))
|
||||
>::apply (pyClass, algorithms(), precallPolicy);
|
||||
|
||||
maybe_add_count <
|
||||
ICE_AND (
|
||||
traits::has_find
|
||||
, ICE_NOT (Flags & disable_search))
|
||||
, traits::index_style
|
||||
maybe_add_count<
|
||||
ICE_AND(
|
||||
traits::has_find,
|
||||
ICE_NOT (Flags & disable_search)),
|
||||
traits::index_style
|
||||
>::apply (pyClass, algorithms(), precallPolicy);
|
||||
|
||||
Algorithms::visitor_helper (pyClass, m_policy);
|
||||
|
||||
@@ -30,7 +30,7 @@ boost::python::indexing::make_iterator (boost::python::object temp)
|
||||
|
||||
try
|
||||
{
|
||||
BOOST_PYTHON_INDEXING_RESET_AUTO_PTR (
|
||||
BOOST_PYTHON_INDEXING_RESET_AUTO_PTR(
|
||||
result, (python_iterator *) new python_iter_iterator (temp));
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ boost::python::indexing::make_iterator (boost::python::object temp)
|
||||
|
||||
try
|
||||
{
|
||||
BOOST_PYTHON_INDEXING_RESET_AUTO_PTR (
|
||||
BOOST_PYTHON_INDEXING_RESET_AUTO_PTR(
|
||||
result, (python_iterator *) new python_getitem_iterator (temp));
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ boost::python::indexing::python_iterator::~python_iterator ()
|
||||
|
||||
boost::python::indexing::python_getitem_iterator
|
||||
::python_getitem_iterator (boost::python::object obj)
|
||||
: m_getitem_method (obj.attr ("__getitem__"))
|
||||
, m_index (0)
|
||||
, m_current()
|
||||
: m_getitem_method (obj.attr ("__getitem__")),
|
||||
m_index (0),
|
||||
m_current()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ boost::python::indexing::python_getitem_iterator::current () const
|
||||
|
||||
boost::python::indexing::python_iter_iterator
|
||||
::python_iter_iterator (boost::python::object obj)
|
||||
: m_next_method (obj.attr ("__iter__")().attr ("next"))
|
||||
, m_current()
|
||||
: m_next_method (obj.attr ("__iter__")().attr ("next")),
|
||||
m_current()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -47,12 +47,12 @@ boost::python::indexing::integer_slice
|
||||
: m_slice (sl)
|
||||
// Leave index members uninitialized
|
||||
{
|
||||
PySlice_GetIndices (
|
||||
reinterpret_cast<PySliceObject *> (m_slice.ptr())
|
||||
, length
|
||||
, &m_start
|
||||
, &m_stop
|
||||
, &m_step);
|
||||
PySlice_GetIndices(
|
||||
reinterpret_cast<PySliceObject *> (m_slice.ptr()),
|
||||
length,
|
||||
&m_start,
|
||||
&m_stop,
|
||||
&m_step);
|
||||
|
||||
if (m_step == 0)
|
||||
{
|
||||
|
||||
@@ -60,8 +60,8 @@ inline int compare (int_wrapper const &lhs, int_wrapper const &rhs);
|
||||
//
|
||||
|
||||
int_wrapper::int_wrapper ()
|
||||
: m_obj_number (our_object_counter++)
|
||||
, m_int (0)
|
||||
: m_obj_number (our_object_counter++),
|
||||
m_int (0)
|
||||
{
|
||||
if (our_trace_flag)
|
||||
{
|
||||
@@ -70,27 +70,27 @@ int_wrapper::int_wrapper ()
|
||||
}
|
||||
|
||||
int_wrapper::int_wrapper (int i)
|
||||
: m_obj_number (our_object_counter++)
|
||||
, m_int (i)
|
||||
: m_obj_number (our_object_counter++),
|
||||
m_int (i)
|
||||
{
|
||||
if (our_trace_flag)
|
||||
{
|
||||
printf ("int_wrapper %u (%d) at %p\n"
|
||||
, m_obj_number
|
||||
, m_int
|
||||
printf ("int_wrapper %u (%d) at %p\n",
|
||||
m_obj_number,
|
||||
m_int
|
||||
, this);
|
||||
}
|
||||
}
|
||||
|
||||
int_wrapper::int_wrapper (int_wrapper const &other)
|
||||
: m_obj_number (our_object_counter++)
|
||||
, m_int (other.m_int)
|
||||
: m_obj_number (our_object_counter++),
|
||||
m_int (other.m_int)
|
||||
{
|
||||
if (our_trace_flag)
|
||||
{
|
||||
printf ("int_wrapper %u (int_wrapper %u at %p) at %p\n"
|
||||
, m_obj_number
|
||||
, other.m_obj_number
|
||||
printf ("int_wrapper %u (int_wrapper %u at %p) at %p\n",
|
||||
m_obj_number,
|
||||
other.m_obj_number
|
||||
, &other
|
||||
, this);
|
||||
}
|
||||
@@ -100,10 +100,10 @@ int_wrapper &int_wrapper::operator= (int_wrapper const &other)
|
||||
{
|
||||
if (our_trace_flag)
|
||||
{
|
||||
printf ("int_wrapper %u at %p = int_wrapper %u at %p\n"
|
||||
, m_obj_number
|
||||
, this
|
||||
, other.m_obj_number
|
||||
printf ("int_wrapper %u at %p = int_wrapper %u at %p\n",
|
||||
m_obj_number
|
||||
, this,
|
||||
other.m_obj_number
|
||||
, &other);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ boost::python::indexing::iterator_range<int *> get_array_plain()
|
||||
boost::python::indexing::iterator_range<int_wrapper *> get_array_wrap()
|
||||
{
|
||||
static int_wrapper array[] = {
|
||||
int_wrapper(8), int_wrapper(6), int_wrapper(4), int_wrapper(2)
|
||||
, int_wrapper(1), int_wrapper(3), int_wrapper(5)
|
||||
, int_wrapper(7), int_wrapper(0) };
|
||||
int_wrapper(8), int_wrapper(6), int_wrapper(4), int_wrapper(2),
|
||||
int_wrapper(1), int_wrapper(3), int_wrapper(5),
|
||||
int_wrapper(7), int_wrapper(0) };
|
||||
|
||||
return BOOST_MAKE_ITERATOR_RANGE (array);
|
||||
}
|
||||
@@ -82,8 +82,8 @@ BOOST_PYTHON_MODULE(test_array_ext)
|
||||
// lifetimes of the array elements.
|
||||
boost::python::class_<Container2>
|
||||
("Array_ref", boost::python::init<int_wrapper *, int_wrapper *>())
|
||||
.def (Suite2::with_policies (
|
||||
boost::python::return_value_policy <
|
||||
.def (Suite2::with_policies(
|
||||
boost::python::return_value_policy<
|
||||
boost::python::reference_existing_object>()));
|
||||
|
||||
boost::python::def ("get_array_wrap", get_array_wrap);
|
||||
|
||||
@@ -143,7 +143,7 @@ void test_direct_proxy ()
|
||||
raw_container_type raw_container (4);
|
||||
|
||||
{
|
||||
std::auto_ptr<proxy_container_type> proxy_auto_p (
|
||||
std::auto_ptr<proxy_container_type> proxy_auto_p(
|
||||
new proxy_container_type (raw_container));
|
||||
|
||||
initial_tests (*proxy_auto_p);
|
||||
@@ -168,7 +168,7 @@ void test_direct_proxy ()
|
||||
|
||||
{
|
||||
// Check construction from iterators
|
||||
proxy_container_type proxy_container (
|
||||
proxy_container_type proxy_container(
|
||||
raw_container.begin(), raw_container.end());
|
||||
|
||||
BOOST_CHECK (proxy_container.is_valid());
|
||||
|
||||
@@ -32,16 +32,16 @@ unsigned int_wrapper::our_object_counter = 0;
|
||||
std::vector<int_wrapper> get_vector ()
|
||||
{
|
||||
static int_wrapper array[] = {
|
||||
int_wrapper(8), int_wrapper(6), int_wrapper(4), int_wrapper(2)
|
||||
, int_wrapper(1), int_wrapper(3), int_wrapper(5)
|
||||
, int_wrapper(7), int_wrapper(0) };
|
||||
int_wrapper(8), int_wrapper(6), int_wrapper(4), int_wrapper(2),
|
||||
int_wrapper(1), int_wrapper(3), int_wrapper(5),
|
||||
int_wrapper(7), int_wrapper(0) };
|
||||
|
||||
return std::vector<int_wrapper>
|
||||
#if BOOST_WORKAROUND (BOOST_MSVC, <=1200)
|
||||
(array, array + sizeof(array) / sizeof (array[0]));
|
||||
#else
|
||||
(boost::python::indexing::begin(array)
|
||||
, boost::python::indexing::end(array));
|
||||
(boost::python::indexing::begin(array),
|
||||
boost::python::indexing::end(array));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user