Case 1
Here we consider
void bar(const foo*); #1
void bar(foo* const) #2
In #1
we've a pointer to a const foo
while in #2
we've a const pointer to a nonconst foo
.
You could use std::is_same
to confirm that they're different:
std::cout << std::is_same<const foo*, foo* const>::value << ' '; //false
Case 2
Here we consider
void bar(const foo**); #3
void bar(foo** const); #4
In #3
we've a pointer to a pointer to a const foo
while in #4
we've a const pointer to a nonconst pointer to a nonconst foo
.
std::cout << std::is_same<const foo**, foo** const>::value << ' '; //false
Moreover, note that const foo *
is the same as foo const *
but this case you don't have in your given examples.
std::cout << std::is_same<const foo *, foo const *>::value << ' '; //true