Merge branch 'develop' into fix/unwanted_adl

This commit is contained in:
morinmorin
2018-09-22 20:47:10 +09:00
committed by GitHub
15 changed files with 387 additions and 67 deletions
+12 -2
View File
@@ -16,8 +16,13 @@ struct new_random_access
{};
struct new_iterator
: public std::iterator< new_random_access, int >
{
typedef new_random_access iterator_category;
typedef int value_type;
typedef std::ptrdiff_t difference_type;
typedef int* pointer;
typedef int& reference;
int& operator*() const { return *m_x; }
new_iterator& operator++() { return *this; }
new_iterator operator++(int) { return *this; }
@@ -36,8 +41,13 @@ struct new_iterator
new_iterator operator+(std::ptrdiff_t, new_iterator x) { return x; }
struct old_iterator
: public std::iterator<std::random_access_iterator_tag, int>
{
typedef std::random_access_iterator_tag iterator_category;
typedef int value_type;
typedef std::ptrdiff_t difference_type;
typedef int* pointer;
typedef int& reference;
int& operator*() const { return *m_x; }
old_iterator& operator++() { return *this; }
old_iterator operator++(int) { return *this; }
+1
View File
@@ -24,6 +24,7 @@
#include <boost/concept_check.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/next_prior.hpp>
#include <boost/mpl/has_xxx.hpp>
+19 -12
View File
@@ -5,10 +5,10 @@
#include <deque>
#include <iterator>
#include <iostream>
#include <cstddef> // std::ptrdiff_t
#include <boost/static_assert.hpp>
#include <boost/noncopyable.hpp>
#include <boost/iterator/is_lvalue_iterator.hpp>
#include <boost/iterator.hpp>
// Last, for BOOST_NO_LVALUE_RETURN_DETECTION
#include <boost/iterator/detail/config_def.hpp>
@@ -20,29 +20,36 @@ struct v
};
struct value_iterator : boost::iterator<std::input_iterator_tag,v>
struct value_iterator
{
typedef std::input_iterator_tag iterator_category;
typedef v value_type;
typedef std::ptrdiff_t difference_type;
typedef v* pointer;
typedef v& reference;
v operator*() const;
};
struct noncopyable_iterator : boost::iterator<std::forward_iterator_tag,boost::noncopyable>
struct noncopyable_iterator
{
typedef std::forward_iterator_tag iterator_category;
typedef boost::noncopyable value_type;
typedef std::ptrdiff_t difference_type;
typedef boost::noncopyable* pointer;
typedef boost::noncopyable& reference;
boost::noncopyable const& operator*() const;
};
template <class T>
struct proxy_iterator
: boost::iterator<std::output_iterator_tag,T>
{
typedef T value_type;
#if BOOST_WORKAROUND(__GNUC__, == 2)
typedef boost::iterator<std::input_iterator_tag,value_type> base;
typedef base::iterator_category iterator_category;
typedef base::difference_type difference_type;
typedef base::pointer pointer;
typedef base::reference reference;
#endif
typedef std::output_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
typedef T* pointer;
typedef T& reference;
struct proxy
{
+27 -21
View File
@@ -5,10 +5,10 @@
#include <deque>
#include <iterator>
#include <iostream>
#include <cstddef> // std::ptrdiff_t
#include <boost/static_assert.hpp>
#include <boost/noncopyable.hpp>
#include <boost/iterator/is_readable_iterator.hpp>
#include <boost/iterator.hpp>
// Last, for BOOST_NO_LVALUE_RETURN_DETECTION
#include <boost/iterator/detail/config_def.hpp>
@@ -20,26 +20,35 @@ struct v
};
struct value_iterator : boost::iterator<std::input_iterator_tag,v>
struct value_iterator
{
typedef std::input_iterator_tag iterator_category;
typedef v value_type;
typedef std::ptrdiff_t difference_type;
typedef v* pointer;
typedef v& reference;
v operator*() const;
};
struct noncopyable_iterator : boost::iterator<std::forward_iterator_tag,boost::noncopyable>
struct noncopyable_iterator
{
typedef std::forward_iterator_tag iterator_category;
typedef boost::noncopyable value_type;
typedef std::ptrdiff_t difference_type;
typedef boost::noncopyable* pointer;
typedef boost::noncopyable& reference;
boost::noncopyable const& operator*() const;
};
struct proxy_iterator : boost::iterator<std::output_iterator_tag,v>
struct proxy_iterator
{
#if BOOST_WORKAROUND(__GNUC__, == 2)
typedef boost::iterator<std::input_iterator_tag,v> base;
typedef base::iterator_category iterator_category;
typedef base::value_type value_type;
typedef base::difference_type difference_type;
typedef base::pointer pointer;
typedef base::reference reference;
#endif
typedef std::output_iterator_tag iterator_category;
typedef v value_type;
typedef std::ptrdiff_t difference_type;
typedef v* pointer;
typedef v& reference;
struct proxy
{
@@ -50,16 +59,13 @@ struct proxy_iterator : boost::iterator<std::output_iterator_tag,v>
proxy operator*() const;
};
struct proxy_iterator2 : boost::iterator<std::output_iterator_tag,v>
struct proxy_iterator2
{
#if BOOST_WORKAROUND(__GNUC__, == 2)
typedef boost::iterator<std::input_iterator_tag,v> base;
typedef base::iterator_category iterator_category;
typedef base::value_type value_type;
typedef base::difference_type difference_type;
typedef base::pointer pointer;
typedef base::reference reference;
#endif
typedef std::output_iterator_tag iterator_category;
typedef v value_type;
typedef std::ptrdiff_t difference_type;
typedef v* pointer;
typedef v& reference;
struct proxy
{
+64
View File
@@ -0,0 +1,64 @@
// Copyright 2003 The Trustees of Indiana University.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Shared container iterator adaptor
// Author: Ronald Garcia
// See http://boost.org/libs/utility/shared_container_iterator.html
// for documentation.
//
// shared_iterator_test.cpp - Regression tests for shared_container_iterator.
//
#include "boost/shared_container_iterator.hpp"
#include "boost/shared_ptr.hpp"
#include <boost/core/lightweight_test.hpp>
#include <vector>
struct resource {
static int count;
resource() { ++count; }
resource(resource const&) { ++count; }
~resource() { --count; }
};
int resource::count = 0;
typedef std::vector<resource> resources_t;
typedef boost::shared_container_iterator< resources_t > iterator;
void set_range(iterator& i, iterator& end) {
boost::shared_ptr< resources_t > objs(new resources_t());
for (int j = 0; j != 6; ++j)
objs->push_back(resource());
i = iterator(objs->begin(),objs);
end = iterator(objs->end(),objs);
BOOST_TEST_EQ(resource::count, 6);
}
int main() {
BOOST_TEST_EQ(resource::count, 0);
{
iterator i;
{
iterator end;
set_range(i,end);
BOOST_TEST_EQ(resource::count, 6);
}
BOOST_TEST_EQ(resource::count, 6);
}
BOOST_TEST_EQ(resource::count, 0);
return boost::report_errors();
}
+17
View File
@@ -6,6 +6,22 @@
//
// See http://www.boost.org for most recent version including documentation.
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <boost/config/pragma_message.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, < 1600)
BOOST_PRAGMA_MESSAGE("Skipping test on msvc-9.0 and below")
int main() {}
#elif defined(BOOST_GCC) && __cplusplus < 201100
BOOST_PRAGMA_MESSAGE("Skipping test on g++ in C++03 mode")
int main() {}
#else
#include <utility>
#include <boost/fusion/adapted/std_pair.hpp>
@@ -14,3 +30,4 @@
#include "detail/zip_iterator_test.ipp"
#endif