Force type of C++ template

前端 未结 6 1268
难免孤独
难免孤独 2020-12-28 21:34

I\'ve a basic template class, but I\'d like to restrain the type of the specialisation to a set of classes or types. e.g.:

template 
class          


        
6条回答
  •  太阳男子
    2020-12-28 21:47

    There are various tricks allowing to check for some things, depending on what your criteria is for the instantiation be allowed or not. In practice you should use an higher lever library for those like Boost's Concept Check.

提交回复
热议问题