У меня есть следующий класс, который должен иметь две константы после объявления.Объявление класса шаблона - не является постоянным выражением
template <int PAGE_DIV_SIZE, int BUFFERS_NUM>
class BufferPool {
//...
}
И вот тестовый код для его использования
void testBufferPool(const int pageDivSize, const int bufferNum){
// other code and declaration
BufferPool <pageDivSize, bufferNum> bufferPool(catalog, devNum, hostCapacityVec, devCapacityVec);
}
Я получаю следующее сообщение об ошибке:
error: ‘pageDivSize’ is not a constant expression
BufferPoolTest.cpp:26:39: note: in template argument for type ‘int’
BufferPoolTest.cpp:26:39: error: ‘bufferNum’ is not a constant expression
BufferPoolTest.cpp:26:39: note: in template argument for type ‘int’
BufferPoolTest.cpp:26:51: error: invalid type in declaration before ‘(’ token
BufferPoolTest.cpp:26:100: error: expression list treated as compound expression in initializer [-fpermissive]
BufferPoolTest.cpp:26:100: error: cannot convert ‘std::vector<long unsigned int>’ to ‘int’ in initialization