From 0a95636faf6c4843348a99dc3a87ab22f4be51be Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 9 Nov 2022 21:19:00 +0300 Subject: [PATCH] Added test for converting func_input_iter increment results to the iterator type. --- test/function_input_iterator_test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/function_input_iterator_test.cpp b/test/function_input_iterator_test.cpp index 4843f01..f64e9f5 100644 --- a/test/function_input_iterator_test.cpp +++ b/test/function_input_iterator_test.cpp @@ -99,6 +99,15 @@ int main() for(std::size_t i = 0; i != 10; ++i) BOOST_TEST_EQ(generated[i], static_cast(42 + i)); + // Test that incrementing the iterator returns a reference to the iterator type + { + typedef boost::iterators::function_input_iterator function_counter_iterator_t; + function_counter_iterator_t it1(counter_generator, 0); + function_counter_iterator_t it2(++it1); + function_counter_iterator_t it3(it2++); + BOOST_TEST_EQ(*it3, 54); + } + #if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ && defined(BOOST_RESULT_OF_USE_DECLTYPE) // test the iterator with lambda expressions