Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Re: newbie question

From: Karl Meerbergen (karl.meerbergen_at_[hidden])
Date: 2006-11-30 05:12:29


Marcin,

Just before the where clause. That did solve the problem.
It does not block my work at this stage. I do not understand myself why
it worked with the insertion of late_check.

Karl

On Wed, 2006-11-29 at 10:02 +0100, Marcin Zalewski wrote:
> Karl,
>
> Where did you insert a late_check? I am not sure if this is something
> that really solves the problem. I can't really see why would you get the
> error you are getting (a bug?) but I think that you could template the
> operator() instead of the whole structure. If you do it that way you
> would not have to instantiate the structure for all different uses but
> only implicitly instantiate the operator.
>
> -m
>
> Karl Meerbergen wrote:
> > The problem I posted yesterday is solved: I inserted late_check.
> >
> > Karl
> >
> >
> >> The following piece of code (the function foo_function()) is ok.
> >>
> >> template <DenseVectorCollection C, VectorExpression E>
> >> where std::Assignable< typename C::dereference_type, typename
> >> E::const_dereference_type >
> >> && std::Integral< typename C::size_type >
> >> && std::SameType< typename C::size_type, typename E::size_type >
> >> void foo_function( C& c, E const& e ) {
> >> typedef typename VectorExpression<E>::size_type size_type ;
> >> assert( c.size() == e.size() ) ;
> >> size_type size = e.size() ;
> >> for (size_type i = 0 ; i < size ; ++i ) c(i) = e(i) ;
> >> }
> >>
> >> But then the functor version struct foo:
> >>
> >> template <DenseVectorCollection C, VectorExpression E>
> >> where std::Assignable< typename C::dereference_type, typename
> >> E::const_dereference_type >
> >> && std::Integral< typename C::size_type >
> >> && std::SameType< typename C::size_type, typename E::size_type >
> >> struct foo {
> >> void operator() ( C& c, E const& e ) const {
> >> typedef typename VectorExpression<E>::size_type size_type ;
> >> assert( c.size() == e.size() ) ;
> >> size_type size = e.size() ;
> >> for (size_type i = 0 ; i < size ; ++i ) c(i) = e(i) ;
> >> }
> >> };
> >>
> >> This produces the error message
> >>
> >> vector.cpp: In member function ‘void glas::foo<C, E>::operator()(C&,
> >> const E&) const’:
> >> vector.cpp:25: error: no match for ‘operator==’ in ‘c->C::size() ==
> >> e->E::size()’
> >> /usr/local/conceptgcc/4.1.1/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/concepts.h:155:
> >> note: candidates are: bool std::Integral<typename
> >> glas::VectorExpression<C>::size_type>::operator==(const typename
> >> glas::VectorExpression<C>::size_type&, const typename
> >> glas::VectorExpression<C>::size_type&)
> >> vector.cpp:26: error: ‘size_type’ has no copy constructor
> >> vector.cpp:27: error: conversion from ‘int’ to non-scalar type
> >> ‘size_type’ requested
> >> vector.cpp:27: error: no match for ‘operator<’ in ‘i < size’
> >>
> >> I have the impression that the where clause is not transferred to the
> >> member function of the functor. Does ring a bell?
> >>
> >> Karl
> _______________________________________________
> ConceptGCC mailing list
> ConceptGCC_at_[hidden]
> http://www.osl.iu.edu/mailman/listinfo.cgi/conceptgcc
>

-- 
Karl Meerbergen
Katholieke Universiteit Leuven
Department of Computer Science
Celestijnenlaan 200A
B-2001 Heverlee
Belgium
E-mail: karl.meerbergen_at_[hidden]
URL   : http://www.cs.kuleuven.be/cwis/research/nalag/
Office: 200A 02.33
Phone : +32 16 327959 (direct)
        +32 16 327700 (secretary)
Fax   : +32 16 327996