diff --git a/include/boost/iterator/advance.hpp b/include/boost/iterator/advance.hpp index 6f81cdb..92af8fb 100644 --- a/include/boost/iterator/advance.hpp +++ b/include/boost/iterator/advance.hpp @@ -77,7 +77,7 @@ namespace iterators { } // namespace iterators -using iterators::advance; +using namespace iterators::advance_adl_barrier; } // namespace boost diff --git a/include/boost/iterator/distance.hpp b/include/boost/iterator/distance.hpp index 8cf3f15..bef650b 100644 --- a/include/boost/iterator/distance.hpp +++ b/include/boost/iterator/distance.hpp @@ -58,7 +58,7 @@ namespace iterators { } // namespace iterators -using iterators::distance; +using namespace iterators::distance_adl_barrier; } // namespace boost diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 888a043..2a0eea0 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -59,6 +59,7 @@ test-suite iterator [ run next_prior_test.cpp ] [ run advance_test.cpp ] [ run distance_test.cpp ] + [ compile adl_test.cpp ] [ run shared_iterator_test.cpp ] ; diff --git a/test/adl_test.cpp b/test/adl_test.cpp new file mode 100644 index 0000000..5d5f699 --- /dev/null +++ b/test/adl_test.cpp @@ -0,0 +1,25 @@ +// Copyright (C) 2017 Michel Morin. +// +// Distributed under 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) + +#include +#include +#include +#include + +int main() +{ + // Test that boost::advance/distance are not found by ADL. + // (https://github.com/boostorg/iterator/issues/43) + + typedef boost::array boost_type; + std::vector std_boost(2); + std::vector::iterator it = std_boost.begin(); + + advance(it, 2); + (void)distance(it, it); + + return 0; +}