Какая функция в следующем фрагменте кода обеспечит наилучшую оптимизацию для внешнего использования и почему? Разрешена ли «Версия 4» в C++ 2011?
template<unsigned int TDIM> class MyClass
{
public:
static inline unsigned int size() {return _size;} // Version 1
static inline const unsigned int size() {return _size;} // Version 2
static constexpr unsigned int size() {return _size;} // Version 3
static inline constexpr unsigned int size() {return _size;} // Version 4
protected:
static const unsigned int _size = TDIM*3;
};
Большое тебе спасибо.