mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-09 23:23:54 +00:00
Merge pull request #73 from Hailios/rvalue_ref_func_iterator
add forward reference assignment operator to function_output_iterator
This commit is contained in:
commit
7b6edb6a7d
@ -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); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user