mirror of
https://github.com/boostorg/utility.git
synced 2025-05-08 18:34:02 +00:00
Made these actually compile
[SVN r11378]
This commit is contained in:
parent
686f822dea
commit
e01de59cdd
@ -42,12 +42,13 @@ 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.
|
||||||
|
#ifndef BOOST_MSVC
|
||||||
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;
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ int main(int, char*[])
|
|||||||
|
|
||||||
char mutable_characters[N];
|
char mutable_characters[N];
|
||||||
char* pointers_to_mutable_chars[N];
|
char* pointers_to_mutable_chars[N];
|
||||||
for (int i = 0; i < N; ++i)
|
for (int j = 0; j < N; ++j)
|
||||||
pointers_to_mutable_chars[i] = &mutable_characters[i];
|
pointers_to_mutable_chars[j] = &mutable_characters[j];
|
||||||
|
|
||||||
PairGen::iterator mutable_indirect_first(pointers_to_mutable_chars),
|
PairGen::iterator mutable_indirect_first(pointers_to_mutable_chars),
|
||||||
mutable_indirect_last(pointers_to_mutable_chars + N);
|
mutable_indirect_last(pointers_to_mutable_chars + N);
|
||||||
@ -51,10 +51,12 @@ int main(int, char*[])
|
|||||||
|
|
||||||
// Example of using make_indirect_iterator()
|
// Example of using make_indirect_iterator()
|
||||||
|
|
||||||
|
#ifndef BOOST_MSVC
|
||||||
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;
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <boost/pending/iterator_adaptors.hpp>
|
#include <boost/iterator_adaptors.hpp>
|
||||||
#include <boost/pending/integer_range.hpp>
|
#include <boost/pending/integer_range.hpp>
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -21,8 +21,7 @@ main(int, char*[])
|
|||||||
int x[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
|
int x[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||||
|
|
||||||
typedef std::binder1st< std::multiplies<int> > Function;
|
typedef std::binder1st< std::multiplies<int> > Function;
|
||||||
typedef boost::transform_iterator<Function, int*,
|
typedef boost::transform_iterator_generator<Function, int*
|
||||||
boost::iterator<std::random_access_iterator_tag, int>
|
|
||||||
>::type doubling_iterator;
|
>::type doubling_iterator;
|
||||||
|
|
||||||
doubling_iterator i(x, std::bind1st(std::multiplies<int>(), 2)),
|
doubling_iterator i(x, std::bind1st(std::multiplies<int>(), 2)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user