
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 09 February 2007 16:18 pm, Doug Gregor wrote:
Returning an Optional if T is default constructible seems like a viable refinement of that solution. I'm a little uncomfortable with exceptions being thrown potentially everywhere along the call chain as a default behaviour.
The problem is that we don't get to return an optional, because the return type is specified as "T", not "optional<T>". And, unfortunately, we can't rely on there always being a default constructor there.
Right now, the implementation is allowed to crash if you call one of these signals and there are no slots. Throwing an exception brings some sane defined behavior to something that is now completely undefined.
If we could reliably detect default-constructibility, we might be able to come up with something better.
We could add a little header with a definition of a "last_optional" combiner for people to use if they prefer. - -- Frank -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFFzOsr5vihyNWuA4URAnwVAJwJWtZucjcUEc/wBtMA6yYqGqhYVQCdGt+I AKtspvUv6bJM9N1zmoFpCuk= =m/Kn -----END PGP SIGNATURE-----