I read the Bjarne Stroustrup mini-paper, βSimplifying the Use of Concepts,β and I came across the following snippet (page 9), which I reproduce below:
concept ABx<typename T> {
void a(T&);
void b(T&);
};
concept Ax<typename T> {
void a(T&);
};
Obviously, every type that a is ABxalso Ax, therefore:
template<Ax T> void f(T);
template<ABx T> void f(T t);
void h(X x)
{
f(x);
}
In other words, in the general case, we must protect against ACxs [sic] a()other than Axs a(). If the two a()can be different, we cannot accept the challenge g(t)above, because it will cause "wrong a()."
I find it difficult to understand this example; in particular, I do not understand the discussion at the end.
- Does Bjarne mean
ABx, not ACx? (Where am I marked [sic]) - ,
X , a(x) b(x) ? a(x), , template<ABx T> void f(T t); , . - , Bjarne, ,
a() . ?
, , ++. , - .