2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-22 17:32:55 +00:00

Use mpl::apply1 with its MSVC6 workarounds to fully support Generator parameter

[SVN r20834]
This commit is contained in:
Raoul Gough
2003-11-17 19:29:09 +00:00
parent b5cd8c537f
commit 3cadfa529e

View File

@@ -34,6 +34,7 @@
#include <vector> // Default pointer container
#include <cassert>
#include <boost/shared_ptr.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <boost/python/suite/indexing/container_traits.hpp>
#include <boost/python/suite/indexing/container_suite.hpp>
@@ -41,6 +42,7 @@
#include <boost/python/suite/indexing/algo_selector.hpp>
namespace boost { namespace python { namespace indexing {
template<typename T> struct identity {
typedef T held_type;
@@ -74,6 +76,19 @@ namespace boost { namespace python { namespace indexing {
};
};
#if BOOST_WORKAROUND (BOOST_MSVC, == 1200)
// Early template instantiation (ETI) workaround
namespace detail {
template<typename Container> struct msvc6_iterator {
typedef Container::iterator type;
};
template<> struct msvc6_iterator<int> {
typedef int *type;
};
}
#endif
template<class Container
, class Holder = identity<Container>
, class Generator = vector_generator>
@@ -254,16 +269,15 @@ namespace boost { namespace python { namespace indexing {
private:
typedef boost::shared_ptr<shared_proxy> pointer_impl;
#if defined (BOOST_NO_MEMBER_TEMPLATES) \
&& defined (BOOST_MSVC6_MEMBER_TEMPLATES)
// Ignore the Generator argument, to avoid an MSVC6 fatal error
// (C1001 internal compiler error).
typedef std::vector<pointer_impl> pointer_container;
typedef typename mpl::apply1<Generator, pointer_impl>::type
pointer_container;
#if BOOST_WORKAROUND (BOOST_MSVC, == 1200)
typedef detail::msvc6_iterator<pointer_container>::type pointer_iterator;
#else
typedef typename Generator::BOOST_PYTHON_INDEXING_NESTED_TEMPLATE
apply<pointer_impl>::type pointer_container;
#endif
typedef typename pointer_container::iterator pointer_iterator;
#endif
#if defined (BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
// Proxies need mutable access, and can't be friends with MSVC6