mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-12 05:51:37 +00:00
Updated to use unique_ptr instead of auto_ptr when appropriate. Removed unnecessary structs.
This commit is contained in:
parent
53e8ac401f
commit
11e3715f37
@ -33,37 +33,6 @@
|
|||||||
|
|
||||||
using boost::dummyT;
|
using boost::dummyT;
|
||||||
|
|
||||||
struct mult_functor {
|
|
||||||
typedef int result_type;
|
|
||||||
typedef int argument_type;
|
|
||||||
// Functors used with transform_iterator must be
|
|
||||||
// DefaultConstructible, as the transform_iterator must be
|
|
||||||
// DefaultConstructible to satisfy the requirements for
|
|
||||||
// TrivialIterator.
|
|
||||||
mult_functor() { }
|
|
||||||
mult_functor(int aa) : a(aa) { }
|
|
||||||
int operator()(int b) const { return a * b; }
|
|
||||||
int a;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Pair>
|
|
||||||
struct select1st_
|
|
||||||
: public std::unary_function<Pair, typename Pair::first_type>
|
|
||||||
{
|
|
||||||
const typename Pair::first_type& operator()(const Pair& x) const {
|
|
||||||
return x.first;
|
|
||||||
}
|
|
||||||
typename Pair::first_type& operator()(Pair& x) const {
|
|
||||||
return x.first;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct one_or_four {
|
|
||||||
bool operator()(dummyT x) const {
|
|
||||||
return x.foo() == 1 || x.foo() == 4;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::deque<int> storage;
|
typedef std::deque<int> storage;
|
||||||
typedef std::deque<int*> pointer_deque;
|
typedef std::deque<int*> pointer_deque;
|
||||||
typedef std::set<storage::iterator> iterator_set;
|
typedef std::set<storage::iterator> iterator_set;
|
||||||
|
@ -56,12 +56,24 @@ int main()
|
|||||||
STATIC_ASSERT_SAME(boost::pointee<X*>::type, X);
|
STATIC_ASSERT_SAME(boost::pointee<X*>::type, X);
|
||||||
STATIC_ASSERT_SAME(boost::pointee<X const*>::type, X const);
|
STATIC_ASSERT_SAME(boost::pointee<X const*>::type, X const);
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
|
|
||||||
STATIC_ASSERT_SAME(boost::pointee<std::auto_ptr<int> >::type, int);
|
STATIC_ASSERT_SAME(boost::pointee<std::auto_ptr<int> >::type, int);
|
||||||
STATIC_ASSERT_SAME(boost::pointee<std::auto_ptr<X> >::type, X);
|
STATIC_ASSERT_SAME(boost::pointee<std::auto_ptr<X> >::type, X);
|
||||||
|
|
||||||
STATIC_ASSERT_SAME(boost::pointee<std::auto_ptr<int const> >::type, int const);
|
STATIC_ASSERT_SAME(boost::pointee<std::auto_ptr<int const> >::type, int const);
|
||||||
STATIC_ASSERT_SAME(boost::pointee<std::auto_ptr<X const> >::type, X const);
|
STATIC_ASSERT_SAME(boost::pointee<std::auto_ptr<X const> >::type, X const);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
STATIC_ASSERT_SAME(boost::pointee<std::unique_ptr<int> >::type, int);
|
||||||
|
STATIC_ASSERT_SAME(boost::pointee<std::unique_ptr<X> >::type, X);
|
||||||
|
|
||||||
|
STATIC_ASSERT_SAME(boost::pointee<std::unique_ptr<int const> >::type, int const);
|
||||||
|
STATIC_ASSERT_SAME(boost::pointee<std::unique_ptr<X const> >::type, X const);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
STATIC_ASSERT_SAME(boost::pointee<std::list<int>::iterator >::type, int);
|
STATIC_ASSERT_SAME(boost::pointee<std::list<int>::iterator >::type, int);
|
||||||
STATIC_ASSERT_SAME(boost::pointee<std::list<X>::iterator >::type, X);
|
STATIC_ASSERT_SAME(boost::pointee<std::list<X>::iterator >::type, X);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user