Skip to content

Commit 993aabc

Browse files
committed
Also ifdef out bound_argument<sigc::reference_wrapper>.
And add a specialization for bound_argument<std::reference_wrapper>.
1 parent c21aba8 commit 993aabc

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

sigc++/adaptors/bound_argument.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class bound_argument
7575
T_type visited_;
7676
};
7777

78+
#ifndef SIGCXX_DISABLE_DEPRECATED
79+
7880
//Template specialization:
7981
/** bound_argument object for a bound argument that is passed by bind() or
8082
* returned by bind_return() by reference, specialized for reference_wrapper<> types.
@@ -142,6 +144,44 @@ class bound_argument< const_reference_wrapper<T_wrapped> >
142144
const_limit_reference<T_wrapped> visited_;
143145
};
144146

147+
#endif // SIGCXX_DISABLE_DEPRECATED
148+
149+
//Template specialization:
150+
/** bound_argument object for a bound argument that is passed by bind() or
151+
* returned by bind_return() by reference, specialized for std::reference_wrapper<> types.
152+
* @e T_wrapped The type of the bound argument.
153+
*/
154+
template <class T_wrapped>
155+
class bound_argument< std::reference_wrapper<T_wrapped> >
156+
{
157+
public:
158+
/** Constructor.
159+
* @param _A_argument The argument to bind.
160+
*/
161+
bound_argument(const std::reference_wrapper<T_wrapped>& _A_argument)
162+
: visited_(unwrap(_A_argument))
163+
{}
164+
165+
/** Retrieve the entity to visit in visit_each().
166+
* @return The limited_reference to the bound argument.
167+
*/
168+
inline const limit_reference<T_wrapped>& visit() const
169+
{ return visited_; }
170+
171+
/** Retrieve the entity to pass to the bound functor or return.
172+
* @return The bound argument.
173+
*/
174+
inline T_wrapped& invoke()
175+
{ return visited_.invoke(); }
176+
177+
private:
178+
/** The limited_reference to the bound argument.
179+
*/
180+
limit_reference<T_wrapped> visited_;
181+
};
182+
183+
184+
145185
#ifndef DOXYGEN_SHOULD_SKIP_THIS
146186
/** Implementation of visitor<>::do_visit_each<>() specialized for the bound_argument class.
147187
* Call visit_each() on the entity returned by the bound_argument's visit()

0 commit comments

Comments
 (0)