Macros are often used for text substitution. In my case, I need to conditionally wipe out some keywords, so that compilation will be possible in compilers that don't have the specific feature.
Specifically I've been looking into cpp11 range where this snippet comes from
template <typename C>
struct has_size {
template <typename T>
static constexpr auto check(T*) -> // problem in VS2013
typename std::is_integral<
decltype(std::declval<T const>().size())>::type;
// .. some more stuff
};
I'm providing this as the example that spawned the question. In the above code I ended up doing
template <typename T>
static
#if COMPILE_WITH_GCC_NEW_ENOUGH
constexpr
#endif
auto check(T*) ->
because there were other parts where constexpr
needed to be replaced with const
in order to compile.
What I'm asking is a way to say eg
#define Constexpr ?????????
so that it would be replaced by constexpr
in gcc compilations and textually nothing in VS compilations.