Mat Marcus
Mon, 01 Sep 2003 18:52:52 +0000
Mat Marcus <[EMAIL PROTECTED]> wrote in message
Right, they're not pointers and you shouldn't see them as such.After reading the documentation more carefully I learned that optional models pointer behavior. I spelled out how the code might look:
boost::tie(*begin, *end); file://sorry, ASSERT && looks too strange
Wow, that looked strange to me. I don't think of begin and end as pointers at all here.
I think that your report is very important because it shows me that while one may expect the need for special constructs in order to 'access' an optional value, such need isn't there when one wants to initialize or assign an optional. It was very reasonable to expect optional<> to work with tie as that is just assignment and assignment is always defined.
I think that OptionalPointee's documentation failed its purpose. That concept is intended to be exactly what you proposed, except that I left initialization/assignment aside.
The concept just explains that the operator * and -> syntax is used to access the a value that is possibly uninitialized, WITHOUT implying that a model of this concept IS a pointer. The concept was invented precisely to allow the same syntax to be used with entities that are NOT pointers.
The particular choice of operators is to allow pointers to be models of the concept.
Perhaps it is the name which is misleading. It can be renamed as PossiblyUninitialized if that helps.
And it should incorporate initialization and assignment.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost