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 abx ax, 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 different ax’s a(). if these 2 a()s can different cannot accept call g(t) above because call “the wrong a().”

i having difficulty understanding example; in particular, don't understand discussion @ end.

  1. did bjarne mean abx rather acx? (where marked [sic])
  2. did bjarne mean x type a(x) , b(x) valid? if a(x) valid, not think template<abx t> void f(t t); should apply, there no ambiguity.
  3. 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

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -