Boost logo

Boost :

From: Iain Denniston (iain.denniston_at_[hidden])
Date: 2007-08-21 16:08:54

Apologies for the delayed response - things got a bit mad here.

> Its argument is <CODE>std::ios_base::fmtflags</CODE> here.

Yes - but fmtflags is simply typedef'd to int somewhere deep in the STL.
Certainly this is the case with STLPort and the dinkumare STL (built in
VC version of STL). Hence anything that is an int or can be converted to
one can be passed as an argument to the function - the precise problem
I'm trying to fix.

> Alternatively, can you make it <CODE>flags(foo_1) | foo2</CODE> (with
> <CODE>flags</CODE> being function) or <CODE>flags | foo_1 | foo2</CODE>?
> By the way, why not perform left shift in flags constructor instead of enum?

Both interesting ideas - I hadn't considered doing either, worth
exploring at least. I'll have a look at them :o)

> I want it to be usable as a template parameter or switch case. For
> instance, <CODE>class_parametrized_with_iosflags<std::ios_base::dec |
> std::ios_base::left></CODE> will not compile. What about
> <CODE>class_parametrized_with_foo<flags<foo>(foo_1) | foo_2></CODE>?

Ahhhh - I see what you want now - sadly AFAIK there is no way to make
that work for the flags lib. Although again I defer to those with
greater C++ skills than I!

Hope that helps


Boost list run by bdawes at, gregod at, cpdaniel at, john at