Boost logo

Boost :

From: Vincent Finn (vincent_finn_at_[hidden])
Date: 2002-11-22 11:38:15


Hi,

I have one comment and one question.
So first the comment

I was recently thinking about a similar thing for a slightly different
purpose. You seem to concentrate on option return values, what about
optional arguments.

e.g.
void fn(int iImportant, optional<int> iNotImportant = optional<int>());

The reasoning for this is similar to for the return
the function could tell if the user had passed in an argument and act
accordingly

Normally you can have a special default value but cases can occur where
and int is valid but none might be required.

The reason I assume you don't allow for this is that your constructor is
explicit and for easier calling sytax in this case that would not be
best (I think)
i.e. I would want to be able to call the above as
fn(1, 3);

The most common reason, though, would be the desire to use references
rather than pointers
int fn1(optional<int&> iMayNotWant = optional<int&>());
instead of
int fn2(int* piMayNotWant = NULL);

I assume this isn't possible since references aren't default
constructable but it would be nice :-)

---
And now the question
can this be used with VC6 ?
I have tried at it won't compile (I'm compiling with boost 1.29)
I get the following error in optional
optional_detail.hpp(91) : error C2371: 'proxy' : redefinition; different 
basic types
         optional_detail.hpp(90) : see declaration of 'proxy'
         optional_detail.hpp(171) : see reference to class template 
instantiation 'boost::optional_detail::value_based_optional<T>' being 
compiled
and lots of errors in
mpl\logical\and.hpp
e.g
mpl\logical\and.hpp(115) : error C2039: 'type' : is not a member of 
'`global namespace''
mpl\logical\and.hpp(115) : error C2146: syntax error : missing ',' 
before identifier 'value'
and a lot more :-(
	Vin

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk