I would like to check if a type is from a particular namespace. Here is what I came up with:
#include
namespace helper
{
template
Unfortunately this technique works only for non-template types. For template types, ADL also checks the namespaces of the template arguments. Then it collects a list of class or function templates (depending on the context ADL is invoked from) and selects the best candidate.
A better solution would be to add an explicit check to the types whose membership in a namespace you want to check. For example, you could derive all types from a certain class or add a special member to each of them. This would be much clearer, easier to understand and maintain solution.