After this question by utilizing ADL one can create a trait to answer if the passed type comes from our namespace:
#include
namespace helper
This seems to work:
#include
#include
#include
#include
namespace other { struct S{}; }
namespace my {
template< class Type >
void ref( Type&& ) {}
template< class Type >
auto ref_to( Type&& o )
-> Type&
{ return o; }
template< class Type >
constexpr auto is_std_type()
-> bool
{
using std::is_same;
using std::declval;
return not is_same< void, decltype( ref( ref_to( declval() ) ) )>::value;
}
struct Blah {};
constexpr bool int_is_std = is_std_type();
constexpr bool blah_is_std = is_std_type();
constexpr bool other_is_std = is_std_type();
constexpr bool string_is_std = is_std_type();
};
#include
using namespace std;
auto main()
-> int
{
cout << boolalpha;
cout << "int is std = " << my::int_is_std << "\n";
cout << "blah is std = " << my::blah_is_std << "\n";
cout << "other is std = " << my::other_is_std << "\n";
cout << "string is std = " << my::string_is_std << "\n";
}