Boost logo

Boost :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2006-09-28 13:31:21

On Sep 28, 2006, at 12:13 PM, Andy Little wrote:
> "Doug Gregor" <dgregor_at_[hidden]> wrote in message
>> If be "sorting it out myself" you mean implementing decltype and auto
>> in GCC, then "yes"! :)
> hmm... (actually that Was a feature request... ;-) ) *Interesting*
> idea though,
> trying to hack Gcc.... very foolhardy IMO, unwise, very unwise...
> :-)

Sure, but if you don't implement it in GCC... who will?

> Am I right that I can add conditional Concept support to headers by :
> # ifdef __GXX_CONCEPTS__
> ... concept stuff
> ?


> And what happens if I have for example a Numeric concept (float, int,
> boost::numeric::interval) and I want to make Integer a
> 'member'( model?). How
> would that work? And integer is also a fundamental type of course

That's what concept maps are for, e.g.,

   concept_map Numeric<integer> { }

> Would I be able somehow to express that I don't want potentially
> 'lossy'
> division. e.g int / int ?

In the concept Numeric (or, perhaps, one of its "refinements", i.e.,
more specific concepts that inherit/refine "Numeric"), you could
write an axiom like:

   axiom NonlossyDivision(T x, T y) {
     y == (x / y) * x;

It's a semantic requirement (and, therefore, unchecked); but, users
have to at least think about it before lying to you about their
division operators.

> Anyway I will have to see how well it works in my physical
> quantities library.
> I'm glad I finally got round to trying it out :-)

Me too :)


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