I need to declare a class that can store various types of containers. Those. it would be nice if it could handle std :: bitset and std :: array. However, these two classes need different template arguments ... Is it possible (and possibly how) to use template template classes and variable templates to declare this class?
Example (but incorrect):
template<template <typename..., std::size_t> class Container, std::size_t N, typename... Args> class Base_Class { ... Container<Args..., N/2> container; };
The compiler complains that N / 2 is not a type. Obviously, for std :: array and std :: bitset I need a size that will be the last parameter of the template ... Is it possible to encode this crazy one?
Thanks!
EDIT: As far as I know, the main problem is that the variation patterns can only be expanded on the right, so the variable parameter should be the last. Does anyone know if there are plans to allow the following syntax in C ++ 17?
template<typename... Args, typename T> struct A {};
source share