Re: [boost] [guidelines] why template errors suck

Well, I believe I got it wrong. It is concept maps where the specializtion is to tke plce. It should read:
explicit concept< typename T > IntOrPair
"explicit concepts" were never part of any accepted proposal ;-)
{ int sum_ints_impl( T const& ); }
concept_map IntOrPair<int> { int sum_ints_impl( int const& i ) { return i; } }
template< IntOrPair type1, IntOrPair type2 > concept_map IntOrPair< std::pair<type1, type2> > { int sum_ints_impl( std::pair<First, Second> const& p ) { return sum_ints_impl(p.first) + sum_ints_impl(p.second); } }
template<IntOrPair T> int sum_ints( T const & t ) { return IntOrPair::sum_ints_impl( t ); }
I think what you wrote is equivalent to what I posted in http://permalink.gmane.org/gmane.comp.lib.boost.devel/209012
However, as I noted in that message, trying to constrain something to be either an Int or a Pair is really against the spirit of GP.
I understand. On the other hand, even though concepts were designed to support GP, once they are designed it would be interesting to see how they can be used to do other thing, and what other possibilities they enable. Regards, &rzej

On Wed, Sep 29, 2010 at 2:06 AM, Andrzej Krzemienski <akrzemi1@gmail.com> wrote:
Well, I believe I got it wrong. It is concept maps where the specializtion is to tke plce. It should read:
explicit concept< typename T > IntOrPair
"explicit concepts" were never part of any accepted proposal ;-)
{ int sum_ints_impl( T const& ); }
concept_map IntOrPair<int> { int sum_ints_impl( int const& i ) { return i; } }
template< IntOrPair type1, IntOrPair type2 > concept_map IntOrPair< std::pair<type1, type2> > { int sum_ints_impl( std::pair<First, Second> const& p ) { return sum_ints_impl(p.first) + sum_ints_impl(p.second); } }
template<IntOrPair T> int sum_ints( T const & t ) { return IntOrPair::sum_ints_impl( t ); }
I think what you wrote is equivalent to what I posted in http://permalink.gmane.org/gmane.comp.lib.boost.devel/209012
However, as I noted in that message, trying to constrain something to be either an Int or a Pair is really against the spirit of GP.
I understand. On the other hand, even though concepts were designed to support GP, once they are designed it would be interesting to see how they can be used to do other thing, and what other possibilities they enable.
In this thread, we're not even close to the point where we have a mutual understanding of how concepts work (technically) or how they can/should be used to describe simple generic algorithms. It seems rather premature to skip that step and go straight to (ab)using concepts for something completely different. The danger, of course, is that we've completely missed the point of concepts, and that our "other possibilities" are really just poor substitutes for using concepts well. - Doug
participants (2)
-
Andrzej Krzemienski
-
Doug Gregor