Merge pull request #73 from Hailios/rvalue_ref_func_iterator

add forward reference assignment operator to function_output_iterator
This commit is contained in:
Andrey Semashev 2022-06-30 23:24:11 +03:00 committed by GitHub
commit 7b6edb6a7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,11 @@
#define BOOST_ITERATOR_FUNCTION_OUTPUT_ITERATOR_HPP
#include <iterator>
#include <boost/config.hpp>
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#include <utility>
#endif
namespace boost {
namespace iterators {
@ -33,10 +38,19 @@ namespace iterators {
struct output_proxy {
output_proxy(UnaryFunction& f) : m_f(f) { }
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
template <class T> output_proxy& operator=(const T& value) {
m_f(value);
return *this;
}
#else
template <class T> output_proxy& operator=(T&& value) {
m_f(std::forward<T>(value));
return *this;
}
#endif
UnaryFunction& m_f;
};
output_proxy operator*() { return output_proxy(m_f); }