C++ concept example from "Simplifying the use of concepts" -
i reading bjarne stroustrup's mini-paper "simplifying use of concepts" , came across following snippet (page 9), reproduce below:
concept abx<typename t> { void a(t&); void b(t&); }; concept ax<typename t> { void a(t&); };obviously, every type that’s
abxax, so:template<ax t> void f(t); template<abx t> void f(t t); void h(x x) // x type a(x) valid { f(x); // ambiguous }in other words, in general, have protect against
acx’s [sic]a()being differentax’sa(). if these 2a()s can different cannot accept callg(t)above because call “the wronga().”
i having difficulty understanding example; in particular, don't understand discussion @ end.
- did bjarne mean
abxratheracx? (where marked [sic]) - did bjarne mean
xtypea(x),b(x)valid? ifa(x)valid, not thinktemplate<abx t> void f(t t);should apply, there no ambiguity. - i don't know bjarne means when claims 2
a()implementations different. don't have same?
i'm sure bjarne's example right, , don't know enough c++ concepts. love if enlighten me.
Comments
Post a Comment