Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
parameter pack workaround
#include <cstdlib> #include <iostream> #include <sstream> #include <vector> template <std::size_t> struct const_size_t { using type = std::size_t; }; template<typename ClassType, std::size_t... Dims> class MatrixCell { private: std::vector<std::size_t> coordinateIndices_; ClassType data_; public: MatrixCell() : coordinateIndices_{Dims...} {} void addItem( ClassType item, typename const_size_t<Dims>::type... dims) { if ( !checkIndex( dims... ) ) { std::ostringstream strStream; strStream << __FUNCTION__ << " current index doesn't exist."; // Logger::log( strStream, Logger::TYPE_ERROR ); // throw ExceptionHandler( strStream ); } else { data_ = item; } } private: bool checkIndex(typename const_size_t<Dims>::type... dims) { return true; } }; int main() { std::cout << "Runs OK\n"; }
run
|
edit
|
history
|
help
0
#32
RVO hota hai bhenchod
"Mostly invalid states" and unordered_set
hangman
0004
wall
constmsvc
hangman
#7
template test