
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 15 April 2009, Steven Watanabe wrote:
AMDG
David Abrahams wrote:
Here's one thing I don't love:
Derived(BOOST_RV_REF(Derived) x) // Move ctor
: Base(boost::move(static_cast<Base&>(x))),
mem_(boost::move(x.mem_)) { }
is there a way to get rid of the static_cast and make
Derived(BOOST_RV_REF(Derived) x) // Move ctor
: Base(boost::move(x)),
mem_(boost::move(x.mem_)) { }
work?
FWIW, I always write copy constructors using the cast, after having been bitten by templated base class constructors a few times.
What about a boost::forward<Base>(x) instead of boost::move(static_cast<Base&>(x)) Isn't forward supposed to be some kind of safe and movable-friendly static_cast? I admit I'm a bit hazy on exactly what std::forward is supposed to accomplish. I see it used in perfect forwarding examples, but they seem to work just as well without it. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAknoei4ACgkQ5vihyNWuA4X4MwCgloI4NsYcHsS47CP3rkPaZq8D FtcAoLtj0KvXdc+AvSkZQRqB3N86Gh34 =YPu0 -----END PGP SIGNATURE-----