mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-11 05:23:52 +00:00
Trim trailing spaces.
This commit is contained in:
parent
c2929ea6c6
commit
80ec58bb3b
@ -41,12 +41,12 @@ int main(int, char*[])
|
|||||||
|
|
||||||
// Use indirect iterator to print out numbers by accessing
|
// Use indirect iterator to print out numbers by accessing
|
||||||
// them through the array of pointers.
|
// them through the array of pointers.
|
||||||
std::cout << "indirectly printing out the numbers from 0 to "
|
std::cout << "indirectly printing out the numbers from 0 to "
|
||||||
<< N << std::endl;
|
<< N << std::endl;
|
||||||
std::copy(boost::make_indirect_iterator(pointers.begin()),
|
std::copy(boost::make_indirect_iterator(pointers.begin()),
|
||||||
boost::make_indirect_iterator(pointers.end()),
|
boost::make_indirect_iterator(pointers.end()),
|
||||||
std::ostream_iterator<int>(std::cout, " "));
|
std::ostream_iterator<int>(std::cout, " "));
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::exit_success;
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,10 @@ int main()
|
|||||||
{
|
{
|
||||||
int numbers_[] = { 0, -1, 4, -3, 5, 8, -2 };
|
int numbers_[] = { 0, -1, 4, -3, 5, 8, -2 };
|
||||||
const int N = sizeof(numbers_)/sizeof(int);
|
const int N = sizeof(numbers_)/sizeof(int);
|
||||||
|
|
||||||
typedef int* base_iterator;
|
typedef int* base_iterator;
|
||||||
base_iterator numbers(numbers_);
|
base_iterator numbers(numbers_);
|
||||||
|
|
||||||
// Example using make_filter_iterator()
|
// Example using make_filter_iterator()
|
||||||
std::copy(boost::make_filter_iterator<is_positive_number>(numbers, numbers + N),
|
std::copy(boost::make_filter_iterator<is_positive_number>(numbers, numbers + N),
|
||||||
boost::make_filter_iterator<is_positive_number>(numbers + N, numbers + N),
|
boost::make_filter_iterator<is_positive_number>(numbers + N, numbers + N),
|
||||||
@ -32,7 +32,7 @@ int main()
|
|||||||
// Example using filter_iterator
|
// Example using filter_iterator
|
||||||
typedef boost::filter_iterator<is_positive_number, base_iterator>
|
typedef boost::filter_iterator<is_positive_number, base_iterator>
|
||||||
FilterIter;
|
FilterIter;
|
||||||
|
|
||||||
is_positive_number predicate;
|
is_positive_number predicate;
|
||||||
FilterIter filter_iter_first(predicate, numbers, numbers + N);
|
FilterIter filter_iter_first(predicate, numbers, numbers + N);
|
||||||
FilterIter filter_iter_last(predicate, numbers + N, numbers + N);
|
FilterIter filter_iter_last(predicate, numbers + N, numbers + N);
|
||||||
@ -45,15 +45,15 @@ int main()
|
|||||||
boost::make_filter_iterator(
|
boost::make_filter_iterator(
|
||||||
boost::bind(std::greater<int>(), boost::placeholders::_1, -2)
|
boost::bind(std::greater<int>(), boost::placeholders::_1, -2)
|
||||||
, numbers, numbers + N)
|
, numbers, numbers + N)
|
||||||
|
|
||||||
, boost::make_filter_iterator(
|
, boost::make_filter_iterator(
|
||||||
boost::bind(std::greater<int>(), boost::placeholders::_1, -2)
|
boost::bind(std::greater<int>(), boost::placeholders::_1, -2)
|
||||||
, numbers + N, numbers + N)
|
, numbers + N, numbers + N)
|
||||||
|
|
||||||
, std::ostream_iterator<int>(std::cout, " ")
|
, std::ostream_iterator<int>(std::cout, " ")
|
||||||
);
|
);
|
||||||
|
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::exit_success;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ struct string_appender
|
|||||||
string_appender(std::string& s)
|
string_appender(std::string& s)
|
||||||
: m_str(&s)
|
: m_str(&s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void operator()(const std::string& x) const
|
void operator()(const std::string& x) const
|
||||||
{
|
{
|
||||||
*m_str += x;
|
*m_str += x;
|
||||||
@ -37,9 +37,9 @@ int main(int, char*[])
|
|||||||
x.push_back("!");
|
x.push_back("!");
|
||||||
|
|
||||||
std::string s = "";
|
std::string s = "";
|
||||||
std::copy(x.begin(), x.end(),
|
std::copy(x.begin(), x.end(),
|
||||||
boost::make_function_output_iterator(string_appender(s)));
|
boost::make_function_output_iterator(string_appender(s)));
|
||||||
|
|
||||||
std::cout << s << std::endl;
|
std::cout << s << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -21,13 +21,13 @@ int main(int, char*[])
|
|||||||
pointers_to_chars[i] = &characters[i];
|
pointers_to_chars[i] = &characters[i];
|
||||||
|
|
||||||
// Example of using indirect_iterator
|
// Example of using indirect_iterator
|
||||||
|
|
||||||
boost::indirect_iterator<char**, char>
|
boost::indirect_iterator<char**, char>
|
||||||
indirect_first(pointers_to_chars), indirect_last(pointers_to_chars + N);
|
indirect_first(pointers_to_chars), indirect_last(pointers_to_chars + N);
|
||||||
|
|
||||||
std::copy(indirect_first, indirect_last, std::ostream_iterator<char>(std::cout, ","));
|
std::copy(indirect_first, indirect_last, std::ostream_iterator<char>(std::cout, ","));
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
|
|
||||||
// Example of making mutable and constant indirect iterators
|
// Example of making mutable and constant indirect iterators
|
||||||
|
|
||||||
@ -48,13 +48,13 @@ int main(int, char*[])
|
|||||||
std::ostream_iterator<char>(std::cout, ","));
|
std::ostream_iterator<char>(std::cout, ","));
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
|
|
||||||
// Example of using make_indirect_iterator()
|
// Example of using make_indirect_iterator()
|
||||||
|
|
||||||
std::copy(boost::make_indirect_iterator(pointers_to_chars),
|
std::copy(boost::make_indirect_iterator(pointers_to_chars),
|
||||||
boost::make_indirect_iterator(pointers_to_chars + N),
|
boost::make_indirect_iterator(pointers_to_chars + N),
|
||||||
std::ostream_iterator<char>(std::cout, ","));
|
std::ostream_iterator<char>(std::cout, ","));
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,11 @@ int main()
|
|||||||
#if defined(BOOST_NO_CXX11_SMART_PTR)
|
#if defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
|
|
||||||
std::auto_ptr<node<int> > nodes(new node<int>(42));
|
std::auto_ptr<node<int> > nodes(new node<int>(42));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
std::unique_ptr<node<int> > nodes(new node<int>(42));
|
std::unique_ptr<node<int> > nodes(new node<int>(42));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nodes->append(new node<std::string>(" is greater than "));
|
nodes->append(new node<std::string>(" is greater than "));
|
||||||
@ -30,7 +30,7 @@ int main()
|
|||||||
, std::ostream_iterator<node_base>(std::cout, " ")
|
, std::ostream_iterator<node_base>(std::cout, " ")
|
||||||
);
|
);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::for_each(
|
std::for_each(
|
||||||
node_iterator(nodes.get()), node_iterator()
|
node_iterator(nodes.get()), node_iterator()
|
||||||
, std::mem_fun_ref(&node_base::double_me)
|
, std::mem_fun_ref(&node_base::double_me)
|
||||||
|
@ -16,11 +16,11 @@ int main()
|
|||||||
#if defined(BOOST_NO_CXX11_SMART_PTR)
|
#if defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
|
|
||||||
std::auto_ptr<node<int> > nodes(new node<int>(42));
|
std::auto_ptr<node<int> > nodes(new node<int>(42));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
std::unique_ptr<node<int> > nodes(new node<int>(42));
|
std::unique_ptr<node<int> > nodes(new node<int>(42));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nodes->append(new node<std::string>(" is greater than "));
|
nodes->append(new node<std::string>(" is greater than "));
|
||||||
@ -29,16 +29,16 @@ int main()
|
|||||||
// Check interoperability
|
// Check interoperability
|
||||||
assert(node_iterator(nodes.get()) == node_const_iterator(nodes.get()));
|
assert(node_iterator(nodes.get()) == node_const_iterator(nodes.get()));
|
||||||
assert(node_const_iterator(nodes.get()) == node_iterator(nodes.get()));
|
assert(node_const_iterator(nodes.get()) == node_iterator(nodes.get()));
|
||||||
|
|
||||||
assert(node_iterator(nodes.get()) != node_const_iterator());
|
assert(node_iterator(nodes.get()) != node_const_iterator());
|
||||||
assert(node_const_iterator(nodes.get()) != node_iterator());
|
assert(node_const_iterator(nodes.get()) != node_iterator());
|
||||||
|
|
||||||
std::copy(
|
std::copy(
|
||||||
node_iterator(nodes.get()), node_iterator()
|
node_iterator(nodes.get()), node_iterator()
|
||||||
, std::ostream_iterator<node_base>(std::cout, " ")
|
, std::ostream_iterator<node_base>(std::cout, " ")
|
||||||
);
|
);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::for_each(
|
std::for_each(
|
||||||
node_iterator(nodes.get()), node_iterator()
|
node_iterator(nodes.get()), node_iterator()
|
||||||
, boost::mem_fn(&node_base::double_me)
|
, boost::mem_fn(&node_base::double_me)
|
||||||
|
@ -16,11 +16,11 @@ int main()
|
|||||||
#if defined(BOOST_NO_CXX11_SMART_PTR)
|
#if defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
|
|
||||||
std::auto_ptr<node<int> > nodes(new node<int>(42));
|
std::auto_ptr<node<int> > nodes(new node<int>(42));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
std::unique_ptr<node<int> > nodes(new node<int>(42));
|
std::unique_ptr<node<int> > nodes(new node<int>(42));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nodes->append(new node<std::string>(" is greater than "));
|
nodes->append(new node<std::string>(" is greater than "));
|
||||||
@ -29,16 +29,16 @@ int main()
|
|||||||
// Check interoperability
|
// Check interoperability
|
||||||
assert(node_iterator(nodes.get()) == node_const_iterator(nodes.get()));
|
assert(node_iterator(nodes.get()) == node_const_iterator(nodes.get()));
|
||||||
assert(node_const_iterator(nodes.get()) == node_iterator(nodes.get()));
|
assert(node_const_iterator(nodes.get()) == node_iterator(nodes.get()));
|
||||||
|
|
||||||
assert(node_iterator(nodes.get()) != node_const_iterator());
|
assert(node_iterator(nodes.get()) != node_const_iterator());
|
||||||
assert(node_const_iterator(nodes.get()) != node_iterator());
|
assert(node_const_iterator(nodes.get()) != node_iterator());
|
||||||
|
|
||||||
std::copy(
|
std::copy(
|
||||||
node_iterator(nodes.get()), node_iterator()
|
node_iterator(nodes.get()), node_iterator()
|
||||||
, std::ostream_iterator<node_base>(std::cout, " ")
|
, std::ostream_iterator<node_base>(std::cout, " ")
|
||||||
);
|
);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::for_each(
|
std::for_each(
|
||||||
node_iterator(nodes.get()), node_iterator()
|
node_iterator(nodes.get()), node_iterator()
|
||||||
, boost::mem_fn(&node_base::double_me)
|
, boost::mem_fn(&node_base::double_me)
|
||||||
|
@ -27,7 +27,7 @@ int main() {
|
|||||||
*el_it = std::distance(elements.begin(), el_it);
|
*el_it = std::distance(elements.begin(), el_it);
|
||||||
|
|
||||||
index_type indices( index_size );
|
index_type indices( index_size );
|
||||||
for(index_type::iterator i_it = indices.begin() ; i_it != indices.end() ; ++i_it )
|
for(index_type::iterator i_it = indices.begin() ; i_it != indices.end() ; ++i_it )
|
||||||
*i_it = element_range_size - index_size + std::distance(indices.begin(), i_it);
|
*i_it = element_range_size - index_size + std::distance(indices.begin(), i_it);
|
||||||
std::reverse( indices.begin(), indices.end() );
|
std::reverse( indices.begin(), indices.end() );
|
||||||
|
|
||||||
|
@ -15,13 +15,13 @@ int main(int, char*[])
|
|||||||
const int N = sizeof(letters_)/sizeof(char) - 1;
|
const int N = sizeof(letters_)/sizeof(char) - 1;
|
||||||
typedef char* base_iterator;
|
typedef char* base_iterator;
|
||||||
base_iterator letters(letters_);
|
base_iterator letters(letters_);
|
||||||
|
|
||||||
std::cout << "original sequence of letters:\t\t\t"
|
std::cout << "original sequence of letters:\t\t\t"
|
||||||
<< letters_ << std::endl;
|
<< letters_ << std::endl;
|
||||||
|
|
||||||
// Use reverse_iterator to print a sequence of letters in reverse
|
// Use reverse_iterator to print a sequence of letters in reverse
|
||||||
// order.
|
// order.
|
||||||
|
|
||||||
boost::reverse_iterator<base_iterator>
|
boost::reverse_iterator<base_iterator>
|
||||||
reverse_letters_first(letters + N),
|
reverse_letters_first(letters + N),
|
||||||
reverse_letters_last(letters);
|
reverse_letters_last(letters);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Copyright 2003 The Trustees of Indiana University.
|
// Copyright 2003 The Trustees of Indiana University.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software
|
// Use, modification and distribution is subject to the Boost Software
|
||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
@ -16,14 +16,14 @@ typedef boost::shared_container_iterator< std::vector<int> > iterator;
|
|||||||
void set_range(iterator& i, iterator& end) {
|
void set_range(iterator& i, iterator& end) {
|
||||||
|
|
||||||
boost::shared_ptr< std::vector<int> > ints(new std::vector<int>());
|
boost::shared_ptr< std::vector<int> > ints(new std::vector<int>());
|
||||||
|
|
||||||
ints->push_back(0);
|
ints->push_back(0);
|
||||||
ints->push_back(1);
|
ints->push_back(1);
|
||||||
ints->push_back(2);
|
ints->push_back(2);
|
||||||
ints->push_back(3);
|
ints->push_back(3);
|
||||||
ints->push_back(4);
|
ints->push_back(4);
|
||||||
ints->push_back(5);
|
ints->push_back(5);
|
||||||
|
|
||||||
i = iterator(ints->begin(),ints);
|
i = iterator(ints->begin(),ints);
|
||||||
end = iterator(ints->end(),ints);
|
end = iterator(ints->end(),ints);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Copyright 2003 The Trustees of Indiana University.
|
// Copyright 2003 The Trustees of Indiana University.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software
|
// Use, modification and distribution is subject to the Boost Software
|
||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ int main() {
|
|||||||
print_range_nl(boost::make_shared_container_iterator(ints->begin(),ints),
|
print_range_nl(boost::make_shared_container_iterator(ints->begin(),ints),
|
||||||
boost::make_shared_container_iterator(ints->end(),ints));
|
boost::make_shared_container_iterator(ints->end(),ints));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Copyright 2003 The Trustees of Indiana University.
|
// Copyright 2003 The Trustees of Indiana University.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software
|
// Use, modification and distribution is subject to the Boost Software
|
||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
#include "boost/shared_ptr.hpp"
|
#include "boost/shared_ptr.hpp"
|
||||||
#include "boost/tuple/tuple.hpp" // for boost::tie
|
#include "boost/tuple/tuple.hpp" // for boost::tie
|
||||||
#include <algorithm> // for std::copy
|
#include <algorithm> // for std::copy
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ int main() {
|
|||||||
|
|
||||||
|
|
||||||
iterator i,end;
|
iterator i,end;
|
||||||
|
|
||||||
boost::tie(i,end) = return_range();
|
boost::tie(i,end) = return_range();
|
||||||
|
|
||||||
std::copy(i,end,std::ostream_iterator<int>(std::cout,","));
|
std::copy(i,end,std::ostream_iterator<int>(std::cout,","));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// (C) Copyright Jeremy Siek 2000-2004.
|
// (C) Copyright Jeremy Siek 2000-2004.
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// accompanying file LICENSE_1_0.txt or copy at
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
template <class Operation>
|
template <class Operation>
|
||||||
class binder1st {
|
class binder1st {
|
||||||
public:
|
public:
|
||||||
typedef typename Operation::result_type result_type;
|
typedef typename Operation::result_type result_type;
|
||||||
@ -70,6 +70,6 @@ main(int, char*[])
|
|||||||
boost::make_transform_iterator(x + N, boost::bind1st(std::plus<int>(), 4)),
|
boost::make_transform_iterator(x + N, boost::bind1st(std::plus<int>(), 4)),
|
||||||
std::ostream_iterator<int>(std::cout, " "));
|
std::ostream_iterator<int>(std::cout, " "));
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ main()
|
|||||||
boost::iterator_traversal<new_iterator>::type tc;
|
boost::iterator_traversal<new_iterator>::type tc;
|
||||||
boost::random_access_traversal_tag derived = tc;
|
boost::random_access_traversal_tag derived = tc;
|
||||||
(void)derived;
|
(void)derived;
|
||||||
|
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
boost_concepts::WritableIteratorConcept<int*> >();
|
boost_concepts::WritableIteratorConcept<int*> >();
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifndef __BORLANDC__
|
#ifndef __BORLANDC__
|
||||||
# include <boost/tuple/tuple.hpp>
|
# include <boost/tuple/tuple.hpp>
|
||||||
#endif
|
#endif
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <boost/core/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
@ -94,13 +94,13 @@ void category_test(
|
|||||||
|
|
||||||
// Pick a random position internal to the range
|
// Pick a random position internal to the range
|
||||||
difference_type offset = (unsigned)rand() % distance;
|
difference_type offset = (unsigned)rand() % distance;
|
||||||
|
|
||||||
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||||
BOOST_TEST(offset >= 0);
|
BOOST_TEST(offset >= 0);
|
||||||
#else
|
#else
|
||||||
assert_nonnegative<difference_type>::test(offset);
|
assert_nonnegative<difference_type>::test(offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CountingIterator internal = start;
|
CountingIterator internal = start;
|
||||||
std::advance(internal, offset);
|
std::advance(internal, offset);
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ void category_test(
|
|||||||
std::pair<CountingIterator,CountingIterator> xy(
|
std::pair<CountingIterator,CountingIterator> xy(
|
||||||
std::equal_range(start, finish, *internal));
|
std::equal_range(start, finish, *internal));
|
||||||
CountingIterator x = xy.first, y = xy.second;
|
CountingIterator x = xy.first, y = xy.second;
|
||||||
|
|
||||||
BOOST_TEST(boost::detail::distance(x, y) == 1);
|
BOOST_TEST(boost::detail::distance(x, y) == 1);
|
||||||
|
|
||||||
// Show that values outside the range can't be found
|
// Show that values outside the range can't be found
|
||||||
@ -122,7 +122,7 @@ void category_test(
|
|||||||
std::vector<value_type> v;
|
std::vector<value_type> v;
|
||||||
for (value_type z = *start; !(z == *finish); ++z)
|
for (value_type z = *start; !(z == *finish); ++z)
|
||||||
v.push_back(z);
|
v.push_back(z);
|
||||||
|
|
||||||
// Note that this test requires a that the first argument is
|
// Note that this test requires a that the first argument is
|
||||||
// dereferenceable /and/ a valid iterator prior to the first argument
|
// dereferenceable /and/ a valid iterator prior to the first argument
|
||||||
boost::random_access_iterator_test(start, v.size(), v.begin());
|
boost::random_access_iterator_test(start, v.size(), v.begin());
|
||||||
@ -200,11 +200,11 @@ void test_container(Container* = 0) // default arg works around MSVC bug
|
|||||||
Container c(1 + (unsigned)rand() % 1673);
|
Container c(1 + (unsigned)rand() % 1673);
|
||||||
|
|
||||||
const typename Container::iterator start = c.begin();
|
const typename Container::iterator start = c.begin();
|
||||||
|
|
||||||
// back off by 1 to leave room for dereferenceable value at the end
|
// back off by 1 to leave room for dereferenceable value at the end
|
||||||
typename Container::iterator finish = start;
|
typename Container::iterator finish = start;
|
||||||
std::advance(finish, c.size() - 1);
|
std::advance(finish, c.size() - 1);
|
||||||
|
|
||||||
test(start, finish);
|
test(start, finish);
|
||||||
|
|
||||||
typedef typename Container::const_iterator const_iterator;
|
typedef typename Container::const_iterator const_iterator;
|
||||||
@ -283,14 +283,14 @@ int main()
|
|||||||
test_integer3<long, std::random_access_iterator_tag, int>();
|
test_integer3<long, std::random_access_iterator_tag, int>();
|
||||||
test_integer<my_int2>();
|
test_integer<my_int2>();
|
||||||
test_integer<my_int3>();
|
test_integer<my_int3>();
|
||||||
|
|
||||||
// Some tests on container iterators, to prove we handle a few different categories
|
// Some tests on container iterators, to prove we handle a few different categories
|
||||||
test_container<std::vector<int> >();
|
test_container<std::vector<int> >();
|
||||||
test_container<std::list<int> >();
|
test_container<std::list<int> >();
|
||||||
# ifndef BOOST_NO_SLIST
|
# ifndef BOOST_NO_SLIST
|
||||||
test_container<BOOST_STD_EXTENSION_NAMESPACE::slist<int> >();
|
test_container<BOOST_STD_EXTENSION_NAMESPACE::slist<int> >();
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
// Also prove that we can handle raw pointers.
|
// Also prove that we can handle raw pointers.
|
||||||
int array[2000];
|
int array[2000];
|
||||||
test(boost::make_counting_iterator(array), boost::make_counting_iterator(array+2000-1));
|
test(boost::make_counting_iterator(array), boost::make_counting_iterator(array+2000-1));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright David Abrahams 2003, Jeremy Siek 2004.
|
// Copyright David Abrahams 2003, Jeremy Siek 2004.
|
||||||
|
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// accompanying file LICENSE_1_0.txt or copy at
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using boost::dummyT;
|
using boost::dummyT;
|
||||||
|
|
||||||
struct one_or_four
|
struct one_or_four
|
||||||
{
|
{
|
||||||
bool operator()(dummyT x) const
|
bool operator()(dummyT x) const
|
||||||
@ -116,7 +116,7 @@ int main()
|
|||||||
boost::function_requires< boost_concepts::WritableIteratorConcept<Iter> >();
|
boost::function_requires< boost_concepts::WritableIteratorConcept<Iter> >();
|
||||||
boost::function_requires< boost_concepts::SinglePassIteratorConcept<Iter> >();
|
boost::function_requires< boost_concepts::SinglePassIteratorConcept<Iter> >();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef boost::iterator_archetype<
|
typedef boost::iterator_archetype<
|
||||||
const dummyT
|
const dummyT
|
||||||
@ -128,7 +128,7 @@ int main()
|
|||||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||||
boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
|
boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // Causes Internal Error in linker.
|
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // Causes Internal Error in linker.
|
||||||
{
|
{
|
||||||
typedef boost::iterator_archetype<
|
typedef boost::iterator_archetype<
|
||||||
@ -165,7 +165,7 @@ int main()
|
|||||||
boost::function_requires< boost_concepts::LvalueIteratorConcept<Iter> >();
|
boost::function_requires< boost_concepts::LvalueIteratorConcept<Iter> >();
|
||||||
boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
|
boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
typedef boost::iterator_archetype<
|
typedef boost::iterator_archetype<
|
||||||
@ -178,7 +178,7 @@ int main()
|
|||||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||||
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // Causes Internal Error in linker.
|
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // Causes Internal Error in linker.
|
||||||
{
|
{
|
||||||
typedef boost::iterator_archetype<
|
typedef boost::iterator_archetype<
|
||||||
@ -215,11 +215,11 @@ int main()
|
|||||||
boost::function_requires< boost_concepts::LvalueIteratorConcept<Iter> >();
|
boost::function_requires< boost_concepts::LvalueIteratorConcept<Iter> >();
|
||||||
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Run-time tests
|
// Run-time tests
|
||||||
|
|
||||||
dummyT array[] = { dummyT(0), dummyT(1), dummyT(2),
|
dummyT array[] = { dummyT(0), dummyT(1), dummyT(2),
|
||||||
dummyT(3), dummyT(4), dummyT(5) };
|
dummyT(3), dummyT(4), dummyT(5) };
|
||||||
const int N = sizeof(array)/sizeof(dummyT);
|
const int N = sizeof(array)/sizeof(dummyT);
|
||||||
|
|
||||||
@ -235,9 +235,9 @@ int main()
|
|||||||
, boost::random_access_traversal_tag
|
, boost::random_access_traversal_tag
|
||||||
>::value
|
>::value
|
||||||
));
|
));
|
||||||
|
|
||||||
//# endif
|
//# endif
|
||||||
|
|
||||||
// On compilers not supporting partial specialization, we can do more type
|
// On compilers not supporting partial specialization, we can do more type
|
||||||
// deduction with deque iterators than with pointers... unless the library
|
// deduction with deque iterators than with pointers... unless the library
|
||||||
// is broken ;-(
|
// is broken ;-(
|
||||||
@ -258,7 +258,7 @@ int main()
|
|||||||
, boost::make_reverse_iterator(array2.begin())
|
, boost::make_reverse_iterator(array2.begin())
|
||||||
),
|
),
|
||||||
dummyT(4), dummyT(1));
|
dummyT(4), dummyT(1));
|
||||||
|
|
||||||
boost::bidirectional_readable_iterator_test(
|
boost::bidirectional_readable_iterator_test(
|
||||||
filter_iter(array+0, array+N),
|
filter_iter(array+0, array+N),
|
||||||
dummyT(1), dummyT(4));
|
dummyT(1), dummyT(4));
|
||||||
|
@ -55,7 +55,7 @@ int main()
|
|||||||
ones ones_generator;
|
ones ones_generator;
|
||||||
vector<int> values(10);
|
vector<int> values(10);
|
||||||
generate(values.begin(), values.end(), ones());
|
generate(values.begin(), values.end(), ones());
|
||||||
|
|
||||||
vector<int> generated;
|
vector<int> generated;
|
||||||
copy(
|
copy(
|
||||||
boost::make_function_input_iterator(ones_generator, 0),
|
boost::make_function_input_iterator(ones_generator, 0),
|
||||||
|
@ -30,16 +30,16 @@ struct my_ptr {
|
|||||||
|
|
||||||
// Borland 5.6.4 and earlier drop const all over the place, so this
|
// Borland 5.6.4 and earlier drop const all over the place, so this
|
||||||
// test will fail in the lines marked with (**)
|
// test will fail in the lines marked with (**)
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef boost::indirect_iterator<int**> Iter;
|
typedef boost::indirect_iterator<int**> Iter;
|
||||||
STATIC_ASSERT_SAME(Iter::value_type, int);
|
STATIC_ASSERT_SAME(Iter::value_type, int);
|
||||||
STATIC_ASSERT_SAME(Iter::reference, int&);
|
STATIC_ASSERT_SAME(Iter::reference, int&);
|
||||||
STATIC_ASSERT_SAME(Iter::pointer, int*);
|
STATIC_ASSERT_SAME(Iter::pointer, int*);
|
||||||
STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t);
|
STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t);
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT((boost::is_convertible<Iter::iterator_category,
|
BOOST_STATIC_ASSERT((boost::is_convertible<Iter::iterator_category,
|
||||||
std::random_access_iterator_tag>::value));
|
std::random_access_iterator_tag>::value));
|
||||||
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||||
@ -54,13 +54,13 @@ int main()
|
|||||||
{
|
{
|
||||||
typedef boost::indirect_iterator<int**, int> Iter;
|
typedef boost::indirect_iterator<int**, int> Iter;
|
||||||
STATIC_ASSERT_SAME(Iter::value_type, int);
|
STATIC_ASSERT_SAME(Iter::value_type, int);
|
||||||
STATIC_ASSERT_SAME(Iter::reference, int&);
|
STATIC_ASSERT_SAME(Iter::reference, int&);
|
||||||
STATIC_ASSERT_SAME(Iter::pointer, int*);
|
STATIC_ASSERT_SAME(Iter::pointer, int*);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef boost::indirect_iterator<int**, const int> Iter;
|
typedef boost::indirect_iterator<int**, const int> Iter;
|
||||||
STATIC_ASSERT_SAME(Iter::value_type, int);
|
STATIC_ASSERT_SAME(Iter::value_type, int);
|
||||||
STATIC_ASSERT_SAME(Iter::reference, const int&);
|
STATIC_ASSERT_SAME(Iter::reference, const int&);
|
||||||
STATIC_ASSERT_SAME(Iter::pointer, const int*); // (**)
|
STATIC_ASSERT_SAME(Iter::pointer, const int*); // (**)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -68,9 +68,9 @@ int main()
|
|||||||
STATIC_ASSERT_SAME(Iter::value_type, zow);
|
STATIC_ASSERT_SAME(Iter::value_type, zow);
|
||||||
STATIC_ASSERT_SAME(Iter::reference, const zow&); // (**)
|
STATIC_ASSERT_SAME(Iter::reference, const zow&); // (**)
|
||||||
STATIC_ASSERT_SAME(Iter::pointer, const zow*); // (**)
|
STATIC_ASSERT_SAME(Iter::pointer, const zow*); // (**)
|
||||||
|
|
||||||
STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t);
|
STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t);
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT((boost::is_convertible<Iter::iterator_category,
|
BOOST_STATIC_ASSERT((boost::is_convertible<Iter::iterator_category,
|
||||||
std::random_access_iterator_tag>::value));
|
std::random_access_iterator_tag>::value));
|
||||||
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||||
@ -79,9 +79,9 @@ int main()
|
|||||||
{
|
{
|
||||||
typedef boost::indirect_iterator<char**, int, std::random_access_iterator_tag, long&, short> Iter;
|
typedef boost::indirect_iterator<char**, int, std::random_access_iterator_tag, long&, short> Iter;
|
||||||
STATIC_ASSERT_SAME(Iter::value_type, int);
|
STATIC_ASSERT_SAME(Iter::value_type, int);
|
||||||
STATIC_ASSERT_SAME(Iter::reference, long&);
|
STATIC_ASSERT_SAME(Iter::reference, long&);
|
||||||
STATIC_ASSERT_SAME(Iter::pointer, int*);
|
STATIC_ASSERT_SAME(Iter::pointer, int*);
|
||||||
STATIC_ASSERT_SAME(Iter::difference_type, short);
|
STATIC_ASSERT_SAME(Iter::difference_type, short);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_element_type, element_type, true)
|
|||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
dummyT array[] = { dummyT(0), dummyT(1), dummyT(2),
|
dummyT array[] = { dummyT(0), dummyT(1), dummyT(2),
|
||||||
dummyT(3), dummyT(4), dummyT(5) };
|
dummyT(3), dummyT(4), dummyT(5) };
|
||||||
const int N = sizeof(array)/sizeof(dummyT);
|
const int N = sizeof(array)/sizeof(dummyT);
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ struct noncopyable_iterator
|
|||||||
typedef std::ptrdiff_t difference_type;
|
typedef std::ptrdiff_t difference_type;
|
||||||
typedef boost::noncopyable* pointer;
|
typedef boost::noncopyable* pointer;
|
||||||
typedef boost::noncopyable& reference;
|
typedef boost::noncopyable& reference;
|
||||||
|
|
||||||
boost::noncopyable const& operator*() const;
|
boost::noncopyable const& operator*() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,13 +50,13 @@ struct proxy_iterator
|
|||||||
typedef std::ptrdiff_t difference_type;
|
typedef std::ptrdiff_t difference_type;
|
||||||
typedef T* pointer;
|
typedef T* pointer;
|
||||||
typedef T& reference;
|
typedef T& reference;
|
||||||
|
|
||||||
struct proxy
|
struct proxy
|
||||||
{
|
{
|
||||||
operator value_type&() const;
|
operator value_type&() const;
|
||||||
proxy& operator=(value_type) const;
|
proxy& operator=(value_type) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
proxy operator*() const;
|
proxy operator*() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -111,14 +111,14 @@ int main()
|
|||||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<lvalue_iterator<char*> >::value);
|
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<lvalue_iterator<char*> >::value);
|
||||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<lvalue_iterator<float> >::value);
|
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<lvalue_iterator<float> >::value);
|
||||||
|
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<v> >::value);
|
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<v> >::value);
|
||||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<int> >::value);
|
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<int> >::value);
|
||||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<char*> >::value);
|
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<char*> >::value);
|
||||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<float> >::value);
|
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<float> >::value);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<v*>::value);
|
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<v*>::value);
|
||||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<v const*>::value);
|
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<v const*>::value);
|
||||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<std::deque<v>::iterator>::value);
|
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<std::deque<v>::iterator>::value);
|
||||||
@ -131,18 +131,18 @@ int main()
|
|||||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<value_iterator>::value);
|
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<value_iterator>::value);
|
||||||
#endif
|
#endif
|
||||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<noncopyable_iterator>::value);
|
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<noncopyable_iterator>::value);
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<v> >::value);
|
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<v> >::value);
|
||||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<int> >::value);
|
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<int> >::value);
|
||||||
#endif
|
#endif
|
||||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<char*> >::value);
|
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<char*> >::value);
|
||||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<float> >::value);
|
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<float> >::value);
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<v> >::value);
|
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<v> >::value);
|
||||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<int> >::value);
|
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<int> >::value);
|
||||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<char*> >::value);
|
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<char*> >::value);
|
||||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<float> >::value);
|
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<float> >::value);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ struct noncopyable_iterator
|
|||||||
typedef std::ptrdiff_t difference_type;
|
typedef std::ptrdiff_t difference_type;
|
||||||
typedef boost::noncopyable* pointer;
|
typedef boost::noncopyable* pointer;
|
||||||
typedef boost::noncopyable& reference;
|
typedef boost::noncopyable& reference;
|
||||||
|
|
||||||
boost::noncopyable const& operator*() const;
|
boost::noncopyable const& operator*() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -49,13 +49,13 @@ struct proxy_iterator
|
|||||||
typedef std::ptrdiff_t difference_type;
|
typedef std::ptrdiff_t difference_type;
|
||||||
typedef v* pointer;
|
typedef v* pointer;
|
||||||
typedef v& reference;
|
typedef v& reference;
|
||||||
|
|
||||||
struct proxy
|
struct proxy
|
||||||
{
|
{
|
||||||
operator v&();
|
operator v&();
|
||||||
proxy& operator=(v) const;
|
proxy& operator=(v) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
proxy operator*() const;
|
proxy operator*() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -66,12 +66,12 @@ struct proxy_iterator2
|
|||||||
typedef std::ptrdiff_t difference_type;
|
typedef std::ptrdiff_t difference_type;
|
||||||
typedef v* pointer;
|
typedef v* pointer;
|
||||||
typedef v& reference;
|
typedef v& reference;
|
||||||
|
|
||||||
struct proxy
|
struct proxy
|
||||||
{
|
{
|
||||||
proxy& operator=(v) const;
|
proxy& operator=(v) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
proxy operator*() const;
|
proxy operator*() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -87,10 +87,10 @@ int main()
|
|||||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<proxy_iterator>::value);
|
BOOST_STATIC_ASSERT(boost::is_readable_iterator<proxy_iterator>::value);
|
||||||
BOOST_STATIC_ASSERT(!boost::is_readable_iterator<proxy_iterator2>::value);
|
BOOST_STATIC_ASSERT(!boost::is_readable_iterator<proxy_iterator2>::value);
|
||||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<value_iterator>::value);
|
BOOST_STATIC_ASSERT(boost::is_readable_iterator<value_iterator>::value);
|
||||||
|
|
||||||
// Make sure inaccessible copy constructor doesn't prevent
|
// Make sure inaccessible copy constructor doesn't prevent
|
||||||
// readability
|
// readability
|
||||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<noncopyable_iterator>::value);
|
BOOST_STATIC_ASSERT(boost::is_readable_iterator<noncopyable_iterator>::value);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,6 @@ int main()
|
|||||||
boost::function_requires< boost_concepts::InteroperableIteratorConcept<rev_iter, c_rev_iter> >();
|
boost::function_requires< boost_concepts::InteroperableIteratorConcept<rev_iter, c_rev_iter> >();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::exit_success;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||||
# include <boost/iterator/is_readable_iterator.hpp>
|
# include <boost/iterator/is_readable_iterator.hpp>
|
||||||
# include <boost/iterator/is_lvalue_iterator.hpp>
|
# include <boost/iterator/is_lvalue_iterator.hpp>
|
||||||
#endif
|
#endif
|
||||||
#include <boost/pending/iterator_tests.hpp>
|
#include <boost/pending/iterator_tests.hpp>
|
||||||
|
|
||||||
# include <boost/core/lightweight_test.hpp>
|
# include <boost/core/lightweight_test.hpp>
|
||||||
@ -58,7 +58,7 @@ struct ptr_iterator
|
|||||||
, boost::random_access_traversal_tag
|
, boost::random_access_traversal_tag
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||||
, V&
|
, V&
|
||||||
#endif
|
#endif
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -69,9 +69,9 @@ private:
|
|||||||
, boost::random_access_traversal_tag
|
, boost::random_access_traversal_tag
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||||
, V&
|
, V&
|
||||||
#endif
|
#endif
|
||||||
> super_t;
|
> super_t;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ptr_iterator() { }
|
ptr_iterator() { }
|
||||||
ptr_iterator(V* d) : super_t(d) { }
|
ptr_iterator(V* d) : super_t(d) { }
|
||||||
@ -95,7 +95,7 @@ struct modify_traversal
|
|||||||
, Traversal
|
, Traversal
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct fwd_iterator
|
struct fwd_iterator
|
||||||
: boost::iterator_adaptor<
|
: boost::iterator_adaptor<
|
||||||
@ -108,7 +108,7 @@ private:
|
|||||||
fwd_iterator<T>
|
fwd_iterator<T>
|
||||||
, boost::forward_iterator_archetype<T>
|
, boost::forward_iterator_archetype<T>
|
||||||
> super_t;
|
> super_t;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
fwd_iterator() { }
|
fwd_iterator() { }
|
||||||
fwd_iterator(boost::forward_iterator_archetype<T> d) : super_t(d) { }
|
fwd_iterator(boost::forward_iterator_archetype<T> d) : super_t(d) { }
|
||||||
@ -126,7 +126,7 @@ private:
|
|||||||
in_iterator<T>
|
in_iterator<T>
|
||||||
, boost::input_iterator_archetype_no_proxy<T>
|
, boost::input_iterator_archetype_no_proxy<T>
|
||||||
> super_t;
|
> super_t;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
in_iterator() { }
|
in_iterator() { }
|
||||||
in_iterator(boost::input_iterator_archetype_no_proxy<T> d) : super_t(d) { }
|
in_iterator(boost::input_iterator_archetype_no_proxy<T> d) : super_t(d) { }
|
||||||
@ -145,7 +145,7 @@ struct constant_iterator
|
|||||||
, Iter
|
, Iter
|
||||||
, typename std::iterator_traits<Iter>::value_type const
|
, typename std::iterator_traits<Iter>::value_type const
|
||||||
> base_t;
|
> base_t;
|
||||||
|
|
||||||
constant_iterator() {}
|
constant_iterator() {}
|
||||||
constant_iterator(Iter it)
|
constant_iterator(Iter it)
|
||||||
: base_t(it) {}
|
: base_t(it) {}
|
||||||
@ -181,7 +181,7 @@ int static_assert_traversal(Iter* = 0, Trav* = 0)
|
|||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
dummyT array[] = { dummyT(0), dummyT(1), dummyT(2),
|
dummyT array[] = { dummyT(0), dummyT(1), dummyT(2),
|
||||||
dummyT(3), dummyT(4), dummyT(5) };
|
dummyT(3), dummyT(4), dummyT(5) };
|
||||||
const int N = sizeof(array)/sizeof(dummyT);
|
const int N = sizeof(array)/sizeof(dummyT);
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ main()
|
|||||||
{
|
{
|
||||||
ptr_iterator<dummyT> i(array);
|
ptr_iterator<dummyT> i(array);
|
||||||
boost::random_access_iterator_test(i, N, array);
|
boost::random_access_iterator_test(i, N, array);
|
||||||
|
|
||||||
ptr_iterator<const dummyT> j(array);
|
ptr_iterator<const dummyT> j(array);
|
||||||
boost::random_access_iterator_test(j, N, array);
|
boost::random_access_iterator_test(j, N, array);
|
||||||
boost::const_nonconst_iterator_test(i, ++j);
|
boost::const_nonconst_iterator_test(i, ++j);
|
||||||
@ -210,25 +210,25 @@ main()
|
|||||||
test = static_assert_same<Iter1::difference_type, std::ptrdiff_t>::value;
|
test = static_assert_same<Iter1::difference_type, std::ptrdiff_t>::value;
|
||||||
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||||
BOOST_STATIC_ASSERT((boost::is_convertible<Iter1::iterator_category, std::random_access_iterator_tag>::value));
|
BOOST_STATIC_ASSERT((boost::is_convertible<Iter1::iterator_category, std::random_access_iterator_tag>::value));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Test computation of default when the Value is const
|
// Test computation of default when the Value is const
|
||||||
typedef ptr_iterator<int const> Iter1;
|
typedef ptr_iterator<int const> Iter1;
|
||||||
test = static_assert_same<Iter1::value_type, int>::value;
|
test = static_assert_same<Iter1::value_type, int>::value;
|
||||||
test = static_assert_same<Iter1::reference, const int&>::value;
|
test = static_assert_same<Iter1::reference, const int&>::value;
|
||||||
|
|
||||||
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<Iter1>::value);
|
BOOST_STATIC_ASSERT(boost::is_readable_iterator<Iter1>::value);
|
||||||
# ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
# ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<Iter1>::value);
|
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<Iter1>::value);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // borland drops constness
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // borland drops constness
|
||||||
test = static_assert_same<Iter1::pointer, int const*>::value;
|
test = static_assert_same<Iter1::pointer, int const*>::value;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -240,24 +240,24 @@ main()
|
|||||||
test = static_assert_same<Iter::reference, int const&>::value;
|
test = static_assert_same<Iter::reference, int const&>::value;
|
||||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // borland drops constness
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // borland drops constness
|
||||||
test = static_assert_same<Iter::pointer, int const*>::value;
|
test = static_assert_same<Iter::pointer, int const*>::value;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<BaseIter>::value);
|
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<BaseIter>::value);
|
||||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<Iter>::value);
|
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<Iter>::value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef modify_traversal<BaseIter, boost::incrementable_traversal_tag> IncrementableIter;
|
typedef modify_traversal<BaseIter, boost::incrementable_traversal_tag> IncrementableIter;
|
||||||
|
|
||||||
static_assert_traversal<BaseIter,boost::random_access_traversal_tag>();
|
static_assert_traversal<BaseIter,boost::random_access_traversal_tag>();
|
||||||
static_assert_traversal<IncrementableIter,boost::incrementable_traversal_tag>();
|
static_assert_traversal<IncrementableIter,boost::incrementable_traversal_tag>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the iterator_adaptor
|
// Test the iterator_adaptor
|
||||||
{
|
{
|
||||||
ptr_iterator<dummyT> i(array);
|
ptr_iterator<dummyT> i(array);
|
||||||
boost::random_access_iterator_test(i, N, array);
|
boost::random_access_iterator_test(i, N, array);
|
||||||
|
|
||||||
ptr_iterator<const dummyT> j(array);
|
ptr_iterator<const dummyT> j(array);
|
||||||
boost::random_access_iterator_test(j, N, array);
|
boost::random_access_iterator_test(j, N, array);
|
||||||
boost::const_nonconst_iterator_test(i, ++j);
|
boost::const_nonconst_iterator_test(i, ++j);
|
||||||
@ -272,9 +272,9 @@ main()
|
|||||||
adaptor_type i(forward_iter);
|
adaptor_type i(forward_iter);
|
||||||
int zero = 0;
|
int zero = 0;
|
||||||
if (zero) // don't do this, just make sure it compiles
|
if (zero) // don't do this, just make sure it compiles
|
||||||
BOOST_TEST((*i).m_x == i->foo());
|
BOOST_TEST((*i).m_x == i->foo());
|
||||||
}
|
}
|
||||||
|
|
||||||
// check operator-> with an input iterator
|
// check operator-> with an input iterator
|
||||||
{
|
{
|
||||||
boost::input_iterator_archetype_no_proxy<dummyT> input_iter;
|
boost::input_iterator_archetype_no_proxy<dummyT> input_iter;
|
||||||
@ -282,7 +282,7 @@ main()
|
|||||||
adaptor_type i(input_iter);
|
adaptor_type i(input_iter);
|
||||||
int zero = 0;
|
int zero = 0;
|
||||||
if (zero) // don't do this, just make sure it compiles
|
if (zero) // don't do this, just make sure it compiles
|
||||||
BOOST_TEST((*i).m_x == i->foo());
|
BOOST_TEST((*i).m_x == i->foo());
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that base_type is correct
|
// check that base_type is correct
|
||||||
|
@ -21,7 +21,7 @@ int main()
|
|||||||
|
|
||||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<iter> >();
|
boost::function_requires< boost_concepts::ReadableIteratorConcept<iter> >();
|
||||||
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<iter> >();
|
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<iter> >();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef boost::iterator_archetype<
|
typedef boost::iterator_archetype<
|
||||||
int
|
int
|
||||||
@ -32,7 +32,7 @@ int main()
|
|||||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<iter> >();
|
boost::function_requires< boost_concepts::ReadableIteratorConcept<iter> >();
|
||||||
boost::function_requires< boost_concepts::WritableIteratorConcept<iter> >();
|
boost::function_requires< boost_concepts::WritableIteratorConcept<iter> >();
|
||||||
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<iter> >();
|
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<iter> >();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef boost::iterator_archetype<
|
typedef boost::iterator_archetype<
|
||||||
const int // I don't like adding const to Value. It is redundant. -JGS
|
const int // I don't like adding const to Value. It is redundant. -JGS
|
||||||
@ -43,7 +43,7 @@ int main()
|
|||||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<iter> >();
|
boost::function_requires< boost_concepts::ReadableIteratorConcept<iter> >();
|
||||||
boost::function_requires< boost_concepts::LvalueIteratorConcept<iter> >();
|
boost::function_requires< boost_concepts::LvalueIteratorConcept<iter> >();
|
||||||
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<iter> >();
|
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<iter> >();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef boost::iterator_archetype<
|
typedef boost::iterator_archetype<
|
||||||
int
|
int
|
||||||
@ -54,7 +54,7 @@ int main()
|
|||||||
boost::function_requires< boost_concepts::WritableIteratorConcept<iter> >();
|
boost::function_requires< boost_concepts::WritableIteratorConcept<iter> >();
|
||||||
boost::function_requires< boost_concepts::LvalueIteratorConcept<iter> >();
|
boost::function_requires< boost_concepts::LvalueIteratorConcept<iter> >();
|
||||||
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<iter> >();
|
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<iter> >();
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::exit_success;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ struct my_iterator1
|
|||||||
: boost::forward_iterator_helper<my_iterator1, char, long, const char*, const char&>
|
: boost::forward_iterator_helper<my_iterator1, char, long, const char*, const char&>
|
||||||
{
|
{
|
||||||
my_iterator1(const char* p) : m_p(p) {}
|
my_iterator1(const char* p) : m_p(p) {}
|
||||||
|
|
||||||
bool operator==(const my_iterator1& rhs) const
|
bool operator==(const my_iterator1& rhs) const
|
||||||
{ return this->m_p == rhs.m_p; }
|
{ return this->m_p == rhs.m_p; }
|
||||||
|
|
||||||
@ -63,9 +63,9 @@ struct my_iterator2
|
|||||||
typedef const char* pointer;
|
typedef const char* pointer;
|
||||||
typedef const char& reference;
|
typedef const char& reference;
|
||||||
typedef std::forward_iterator_tag iterator_category;
|
typedef std::forward_iterator_tag iterator_category;
|
||||||
|
|
||||||
my_iterator2(const char* p) : m_p(p) {}
|
my_iterator2(const char* p) : m_p(p) {}
|
||||||
|
|
||||||
bool operator==(const my_iterator2& rhs) const
|
bool operator==(const my_iterator2& rhs) const
|
||||||
{ return this->m_p == rhs.m_p; }
|
{ return this->m_p == rhs.m_p; }
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ maybe_pointer_test<int*, int, std::ptrdiff_t, int*, int&, std::random_access_ite
|
|||||||
|
|
||||||
non_pointer_test<my_iterator1, char, long, const char*, const char&, std::forward_iterator_tag>
|
non_pointer_test<my_iterator1, char, long, const char*, const char&, std::forward_iterator_tag>
|
||||||
my_iterator1_test;
|
my_iterator1_test;
|
||||||
|
|
||||||
non_pointer_test<my_iterator2, char, long, const char*, const char&, std::forward_iterator_tag>
|
non_pointer_test<my_iterator2, char, long, const char*, const char&, std::forward_iterator_tag>
|
||||||
my_iterator2_test;
|
my_iterator2_test;
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ int main()
|
|||||||
{
|
{
|
||||||
std::list<int> l(length);
|
std::list<int> l(length);
|
||||||
BOOST_TEST(boost::detail::distance(l.begin(), l.end()) == length);
|
BOOST_TEST(boost::detail::distance(l.begin(), l.end()) == length);
|
||||||
|
|
||||||
std::vector<int> v(length);
|
std::vector<int> v(length);
|
||||||
BOOST_TEST(boost::detail::distance(v.begin(), v.end()) == length);
|
BOOST_TEST(boost::detail::distance(v.begin(), v.end()) == length);
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ void iterop_test()
|
|||||||
{
|
{
|
||||||
typedef boost::permutation_iterator< double*, int const* > permutation_type;
|
typedef boost::permutation_iterator< double*, int const* > permutation_type;
|
||||||
typedef boost::permutation_iterator< double const*, int const* > permutation_const_type;
|
typedef boost::permutation_iterator< double const*, int const* > permutation_const_type;
|
||||||
|
|
||||||
BOOST_CONCEPT_ASSERT((
|
BOOST_CONCEPT_ASSERT((
|
||||||
boost_concepts::InteroperableIteratorConcept<
|
boost_concepts::InteroperableIteratorConcept<
|
||||||
permutation_type
|
permutation_type
|
||||||
@ -58,7 +58,7 @@ void permutation_test()
|
|||||||
permutation_type begin = boost::make_permutation_iterator( elements.begin(), indices.begin() );
|
permutation_type begin = boost::make_permutation_iterator( elements.begin(), indices.begin() );
|
||||||
permutation_type it = begin;
|
permutation_type it = begin;
|
||||||
permutation_type end = boost::make_permutation_iterator( elements.begin(), indices.end() );
|
permutation_type end = boost::make_permutation_iterator( elements.begin(), indices.end() );
|
||||||
|
|
||||||
BOOST_CHECK( it == begin );
|
BOOST_CHECK( it == begin );
|
||||||
BOOST_CHECK( it != end );
|
BOOST_CHECK( it != end );
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ void permutation_test()
|
|||||||
}
|
}
|
||||||
|
|
||||||
it = begin;
|
it = begin;
|
||||||
for( int i1 = 0; i1 < index_size - 1 ; ++++i1, ++++it )
|
for( int i1 = 0; i1 < index_size - 1 ; ++++i1, ++++it )
|
||||||
{
|
{
|
||||||
index_type::iterator i_it2 = indices.begin();
|
index_type::iterator i_it2 = indices.begin();
|
||||||
std::advance( i_it2, i1 );
|
std::advance( i_it2, i1 );
|
||||||
@ -79,14 +79,14 @@ void permutation_test()
|
|||||||
|
|
||||||
it = begin;
|
it = begin;
|
||||||
std::advance(it, index_size);
|
std::advance(it, index_size);
|
||||||
for( index_type::iterator i_it3 = indices.end(); it != begin; )
|
for( index_type::iterator i_it3 = indices.end(); it != begin; )
|
||||||
{
|
{
|
||||||
BOOST_CHECK( *--it == elements[ *--i_it3 ] );
|
BOOST_CHECK( *--it == elements[ *--i_it3 ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
it = begin;
|
it = begin;
|
||||||
std::advance(it, index_size);
|
std::advance(it, index_size);
|
||||||
for( int i2 = 0; i2 < index_size - 1; i2+=2, --it )
|
for( int i2 = 0; i2 < index_size - 1; i2+=2, --it )
|
||||||
{
|
{
|
||||||
index_type::iterator i_it4 = --indices.end();
|
index_type::iterator i_it4 = --indices.end();
|
||||||
std::advance( i_it4, -i2 );
|
std::advance( i_it4, -i2 );
|
||||||
|
@ -35,7 +35,7 @@ struct X {
|
|||||||
template <class T> operator T&() const;
|
template <class T> operator T&() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
STATIC_ASSERT_SAME(boost::pointee<proxy_ref_ptr<int> >::type, int);
|
STATIC_ASSERT_SAME(boost::pointee<proxy_ref_ptr<int> >::type, int);
|
||||||
@ -43,16 +43,16 @@ int main()
|
|||||||
|
|
||||||
STATIC_ASSERT_SAME(boost::pointee<proxy_ref_ptr<int const> >::type, int const);
|
STATIC_ASSERT_SAME(boost::pointee<proxy_ref_ptr<int const> >::type, int const);
|
||||||
STATIC_ASSERT_SAME(boost::pointee<proxy_ref_ptr<X const> >::type, X const);
|
STATIC_ASSERT_SAME(boost::pointee<proxy_ref_ptr<X const> >::type, X const);
|
||||||
|
|
||||||
STATIC_ASSERT_SAME(boost::pointee<proxy_value_ptr<int> >::type, int const);
|
STATIC_ASSERT_SAME(boost::pointee<proxy_value_ptr<int> >::type, int const);
|
||||||
STATIC_ASSERT_SAME(boost::pointee<proxy_value_ptr<X> >::type, X const);
|
STATIC_ASSERT_SAME(boost::pointee<proxy_value_ptr<X> >::type, X const);
|
||||||
|
|
||||||
STATIC_ASSERT_SAME(boost::pointee<proxy_value_ptr<int const> >::type, int const);
|
STATIC_ASSERT_SAME(boost::pointee<proxy_value_ptr<int const> >::type, int const);
|
||||||
STATIC_ASSERT_SAME(boost::pointee<proxy_value_ptr<X const> >::type, X const);
|
STATIC_ASSERT_SAME(boost::pointee<proxy_value_ptr<X const> >::type, X const);
|
||||||
|
|
||||||
STATIC_ASSERT_SAME(boost::pointee<int*>::type, int);
|
STATIC_ASSERT_SAME(boost::pointee<int*>::type, int);
|
||||||
STATIC_ASSERT_SAME(boost::pointee<int const*>::type, int const);
|
STATIC_ASSERT_SAME(boost::pointee<int const*>::type, int const);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ int main()
|
|||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ int main()
|
|||||||
|
|
||||||
STATIC_ASSERT_SAME(boost::pointee<std::unique_ptr<int> >::type, int);
|
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<X> >::type, X);
|
||||||
|
|
||||||
STATIC_ASSERT_SAME(boost::pointee<std::unique_ptr<int const> >::type, int const);
|
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);
|
STATIC_ASSERT_SAME(boost::pointee<std::unique_ptr<X const> >::type, X const);
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ int main()
|
|||||||
|
|
||||||
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);
|
||||||
|
|
||||||
STATIC_ASSERT_SAME(boost::pointee<std::list<int>::const_iterator >::type, int const);
|
STATIC_ASSERT_SAME(boost::pointee<std::list<int>::const_iterator >::type, int const);
|
||||||
STATIC_ASSERT_SAME(boost::pointee<std::list<X>::const_iterator >::type, X const);
|
STATIC_ASSERT_SAME(boost::pointee<std::list<X>::const_iterator >::type, X const);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -20,7 +20,7 @@ using boost::dummyT;
|
|||||||
// Test reverse iterator
|
// Test reverse iterator
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
dummyT array[] = { dummyT(0), dummyT(1), dummyT(2),
|
dummyT array[] = { dummyT(0), dummyT(1), dummyT(2),
|
||||||
dummyT(3), dummyT(4), dummyT(5) };
|
dummyT(3), dummyT(4), dummyT(5) };
|
||||||
const int N = sizeof(array)/sizeof(dummyT);
|
const int N = sizeof(array)/sizeof(dummyT);
|
||||||
|
|
||||||
@ -104,29 +104,29 @@ int main()
|
|||||||
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Test reverse_iterator
|
// Test reverse_iterator
|
||||||
{
|
{
|
||||||
dummyT reversed[N];
|
dummyT reversed[N];
|
||||||
std::copy(array, array + N, reversed);
|
std::copy(array, array + N, reversed);
|
||||||
std::reverse(reversed, reversed + N);
|
std::reverse(reversed, reversed + N);
|
||||||
|
|
||||||
typedef boost::reverse_iterator<dummyT*> reverse_iterator;
|
typedef boost::reverse_iterator<dummyT*> reverse_iterator;
|
||||||
|
|
||||||
reverse_iterator i(reversed + N);
|
reverse_iterator i(reversed + N);
|
||||||
boost::random_access_iterator_test(i, N, array);
|
boost::random_access_iterator_test(i, N, array);
|
||||||
|
|
||||||
boost::random_access_iterator_test(boost::make_reverse_iterator(reversed + N), N, array);
|
boost::random_access_iterator_test(boost::make_reverse_iterator(reversed + N), N, array);
|
||||||
|
|
||||||
typedef boost::reverse_iterator<const dummyT*> const_reverse_iterator;
|
typedef boost::reverse_iterator<const dummyT*> const_reverse_iterator;
|
||||||
|
|
||||||
const_reverse_iterator j(reversed + N);
|
const_reverse_iterator j(reversed + N);
|
||||||
boost::random_access_iterator_test(j, N, array);
|
boost::random_access_iterator_test(j, N, array);
|
||||||
|
|
||||||
const dummyT* const_reversed = reversed;
|
const dummyT* const_reversed = reversed;
|
||||||
|
|
||||||
boost::random_access_iterator_test(boost::make_reverse_iterator(const_reversed + N), N, array);
|
boost::random_access_iterator_test(boost::make_reverse_iterator(const_reversed + N), N, array);
|
||||||
|
|
||||||
boost::const_nonconst_iterator_test(i, ++j);
|
boost::const_nonconst_iterator_test(i, ++j);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ int main()
|
|||||||
// (e.g. "reversed + N") is used in the constructor below.
|
// (e.g. "reversed + N") is used in the constructor below.
|
||||||
const std::deque<dummyT>::iterator finish = reversed_container.end();
|
const std::deque<dummyT>::iterator finish = reversed_container.end();
|
||||||
reverse_iterator i(finish);
|
reverse_iterator i(finish);
|
||||||
|
|
||||||
boost::random_access_iterator_test(i, N, array);
|
boost::random_access_iterator_test(i, N, array);
|
||||||
boost::random_access_iterator_test(boost::make_reverse_iterator(reversed + N), N, array);
|
boost::random_access_iterator_test(boost::make_reverse_iterator(reversed + N), N, array);
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ int main()
|
|||||||
|
|
||||||
const std::deque<dummyT>::const_iterator const_reversed = reversed;
|
const std::deque<dummyT>::const_iterator const_reversed = reversed;
|
||||||
boost::random_access_iterator_test(boost::make_reverse_iterator(const_reversed + N), N, array);
|
boost::random_access_iterator_test(boost::make_reverse_iterator(const_reversed + N), N, array);
|
||||||
|
|
||||||
// Many compilers' builtin deque iterators don't interoperate well, though
|
// Many compilers' builtin deque iterators don't interoperate well, though
|
||||||
// STLport fixes that problem.
|
// STLport fixes that problem.
|
||||||
#if defined(__SGI_STL_PORT) \
|
#if defined(__SGI_STL_PORT) \
|
||||||
@ -164,9 +164,9 @@ int main()
|
|||||||
&& !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) \
|
&& !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) \
|
||||||
&& !BOOST_WORKAROUND(__LIBCOMO_VERSION__, BOOST_TESTED_AT(29)) \
|
&& !BOOST_WORKAROUND(__LIBCOMO_VERSION__, BOOST_TESTED_AT(29)) \
|
||||||
&& !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 1)
|
&& !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 1)
|
||||||
|
|
||||||
boost::const_nonconst_iterator_test(i, ++j);
|
boost::const_nonconst_iterator_test(i, ++j);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
// Copyright 2003 The Trustees of Indiana University.
|
// Copyright 2003 The Trustees of Indiana University.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software
|
// Use, modification and distribution is subject to the Boost Software
|
||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
// Shared container iterator adaptor
|
// Shared container iterator adaptor
|
||||||
// Author: Ronald Garcia
|
// Author: Ronald Garcia
|
||||||
// See http://boost.org/libs/utility/shared_container_iterator.html
|
// See http://boost.org/libs/utility/shared_container_iterator.html
|
||||||
// for documentation.
|
// for documentation.
|
||||||
|
|
||||||
//
|
//
|
||||||
// shared_iterator_test.cpp - Regression tests for shared_container_iterator.
|
// shared_iterator_test.cpp - Regression tests for shared_container_iterator.
|
||||||
@ -38,7 +38,7 @@ void set_range(iterator& i, iterator& end) {
|
|||||||
|
|
||||||
for (int j = 0; j != 6; ++j)
|
for (int j = 0; j != 6; ++j)
|
||||||
objs->push_back(resource());
|
objs->push_back(resource());
|
||||||
|
|
||||||
i = iterator(objs->begin(),objs);
|
i = iterator(objs->begin(),objs);
|
||||||
end = iterator(objs->end(),objs);
|
end = iterator(objs->end(),objs);
|
||||||
BOOST_TEST_EQ(resource::count, 6);
|
BOOST_TEST_EQ(resource::count, 6);
|
||||||
@ -48,7 +48,7 @@ void set_range(iterator& i, iterator& end) {
|
|||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
BOOST_TEST_EQ(resource::count, 0);
|
BOOST_TEST_EQ(resource::count, 0);
|
||||||
|
|
||||||
{
|
{
|
||||||
iterator i;
|
iterator i;
|
||||||
{
|
{
|
||||||
@ -59,6 +59,6 @@ int main() {
|
|||||||
BOOST_TEST_EQ(resource::count, 6);
|
BOOST_TEST_EQ(resource::count, 6);
|
||||||
}
|
}
|
||||||
BOOST_TEST_EQ(resource::count, 0);
|
BOOST_TEST_EQ(resource::count, 0);
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ struct mult_functor {
|
|||||||
int a;
|
int a;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct adaptable_mult_functor
|
struct adaptable_mult_functor
|
||||||
: mult_functor
|
: mult_functor
|
||||||
{
|
{
|
||||||
typedef int result_type;
|
typedef int result_type;
|
||||||
@ -249,7 +249,7 @@ main()
|
|||||||
);
|
);
|
||||||
|
|
||||||
boost::constant_lvalue_iterator_test(
|
boost::constant_lvalue_iterator_test(
|
||||||
boost::make_transform_iterator((pair_t*)values, const_select_first()), x[0]);
|
boost::make_transform_iterator((pair_t*)values, const_select_first()), x[0]);
|
||||||
|
|
||||||
boost::non_const_lvalue_iterator_test(
|
boost::non_const_lvalue_iterator_test(
|
||||||
boost::make_transform_iterator((pair_t*)values, select_first()), x[0], 17);
|
boost::make_transform_iterator((pair_t*)values, select_first()), x[0], 17);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user