Boost logo

Glas :

Re: [glas] Concept C++ [was Re: back to business}

From: Karl Meerbergen (karl.meerbergen_at_[hidden])
Date: 2006-11-28 03:05:32


On Mon, 2006-11-27 at 13:01 -0500, Peter Gottschling wrote:
>
> On Nov 22, 2006, at 9:14 AM, Karl Meerbergen wrote:
>
> > I see an immediate application of concept_map: glas::dense_vector
> > becomes a EuclideanVectorspace, e.g.
> >
> >
> > template <typename T>
> > concept_map EuclideanVectorspace< dense_vector<T> > {
> > real_type norm() const {
> > return norm_2(v) ;
> > }
> >
> >
>
>
> That is an interesting idea to define a concept-dependent default
> norm. However, we have to consider potential conflicts for vector
> types that model multiple concepts with different default norms.
>
>
> template <typename T>
> concept_map L1VectorSpace< dense_vector<T> > {
> real_type norm() const {
> return norm_1(v) ;
> }
> }
>
>
> concept L12VectorSpace<typename Vector>
> : L1VectorSpace<Vector>, EuclideanVectorSpace<Vector>
> {}
>
>
> One solution to resolve this conflict is to introduce a convention
> which norm is prioritized over the other (assuming we can agree on
> one).

I think this kind of issues is application dependent. Do you know a
situation where an algorithm mixes vector spaces for the same vector?
Adaptors can be a solution that map a vector in a specific space.

Karl