I want to wrap the bind class template into an separate namespace:
namespace my_space {
template<typename... R> using bind = std::bind<R...>;
}
and get an error:
error: 'bind<R ...>' in namespace 'std' does not name a type.
How am i able to do so? A small example can be found here.
Your code doesn't compile because std::bind
is a function, not a type. You can declare aliases using using
only for types.
While g++
diagnostic is not exactly the best, Clang++ would have given you the following error:
error: expected a type
which is much clearer*.
Thankfully you can just import the std::bind
name using:
namespace my_space {
using std::bind;
}
This is specifically defined in:
§7.3.3/1 The
using
declaration [namespace.alias]A using-declaration introduces a name into the declarative region in which the using-declaration appears.
* Personal opinion.