|
Boost Users : |
Subject: [Boost-users] [Ref] unwrap_ref and TR1
From: Krzysztof Żelechowski (giecrilj_at_[hidden])
Date: 2011-12-14 15:11:03
The following code is valid:
#if 1
#include <boost/ref.hpp>
int const & (&b_unwrap_ref) (int const &) ((::boost ::unwrap_ref));
#endif
The following code, however, is not (as of libstdc++ 4.5.1):
#if 1
#include <tr1/functional>
int const & (&tr1_unwrap_ref) (int const &) ((::std ::tr1 ::unwrap_ref));
#endif
With the following diagnostic:
> error: âunwrap_refâ is not a member of âstd::tr1â
So I started to ask myself: WTF?
* It turns out that unwrap_ref did not make it to TR1, although
reference_wrapper did.
But why?
* Because ref.hpp did not provide it when TR1 was formed? [1]
Implication:
* unwrap_ref (std:: reference wrapper) is a mismatch.
#if 1
void test () {
unwrap_ref (::boost ::cref (0));
unwrap_ref (::std ::tr1 ::cref (0)); // error: âunwrap_refâ was not
declared in this scope
::boost ::unwrap_ref (::std ::tr1 ::cref (0)); // error: error:
invalid initialization of non-const reference
}
#endif
Shouldn't we do something about it? Like, e.g., extend the scope of
unwrap_ref to cover the corresponding standard class?
This would at least allow expression #3.
Chris
___
[1] <URL:
https://svn.boost.org/svn/boost/!svn/bc/16384/trunk/boost/boost/ref.hpp >
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net