I\'m trying to get the following C++ code running:
#include
template class ConditionalData {
};
template
If you cannot(/don't want to) change ConditionalData
, you may create 2 methods instead:
template
void SetData(ConditionalData& , const T& ) {/* Nothing */}
template
void SetData(ConditionalData& c, const T& value) { c.setData(value); }
and then
A() {
ConditionalData data;
SetData(data, 3);
}
For more complex cases
template
void A_impl_part1(ConditionalData&) {/* Nothing */}
template
void A_impl_part1(ConditionalData& c) { c.setData(3); }
and then
A() {
ConditionalData data;
A_impl_part1(data);
// common part
// A_impl_part2(data); // and so on
}