Answer the question
In order to leave comments, you need to log in
Is it possible to declare a class member variable using metaprogramming?
Code example:
template <typename T, bool someCondition>
class Example
{
// #ifdef SOME_CONDITION
// int x;
// #endif
// ↓ ↓ ↓ Ниже представлен псевдокод-эквивалент закомментированому коду выше: ↓ ↓ ↓
if constexpr (someCondition)
{
int x;
}
/* Some code... */
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question