Skip to main content
2 votes
0 answers
103 views

Usually I define my template classes as following (template<template<class> class T> is essential here): // Foo.h template<template<class> class T> class Foo { void foo(); ...
master_clown's user avatar
3 votes
2 answers
162 views

To create a C++ class template that takes a standard container as a template argument I would do something like #include <vector> template <template<typename U,typename A=std::allocator&...
Olof's user avatar
  • 133
3 votes
0 answers
177 views

In C++26, the following code is legal (see p2841r7 and Herb Sutter's article): template<typename<typename> concept C, template<typename> auto vt, typename T> requires C<T> auto ...
xmllmx's user avatar
  • 44.7k
-1 votes
1 answer
111 views

I have a function which takes a template template parameter, e.g.: template <template <typename K, typename V> typename Map> void foo(); I want to specify a default value for Map; namely, ...
einpoklum's user avatar
  • 139k
2 votes
1 answer
82 views

I'm building trait-types (similar to std::type_identity) to represent template-templates of the different flavors. Mixed-type variadic value templates are a special case, and I can only think of doing ...
xaxazak's user avatar
  • 1,048
1 vote
0 answers
46 views

I have this code perfectly working on clang template <template <typename, typename> typename T> struct CollectIntoAllocatedContainer { // ... }; template <template <typename, ...
burbokop's user avatar
1 vote
2 answers
98 views

I want to call different template member functions with the same sequence of input types, in order to reduce boilerplate code, I tried to implement a dispatcher function, for_each_type, struct A { ...
user416983's user avatar
  • 1,116
2 votes
1 answer
75 views

I have a class template taking a template template parameter template<template<class> typename T> struct S {}; and a class template taking 2 template parameters template<size_t i, ...
PyOPTProblem's user avatar
0 votes
1 answer
69 views

For a project I'm working on I have been trying to implement a typelist with template class.s as the possible types. The relevant parts of my implementation are below. It works well generally but it ...
Gemini Em's user avatar
0 votes
1 answer
107 views

There is a very similar question, but I did not understand how I could apply the workarounds to my code. It was more about achieving generality across different container types: Visual C++ cannot ...
typ1232's user avatar
  • 5,613
1 vote
0 answers
36 views

In C++20, is it possible for a concept to be templated on another concept? I can do template <typename R> concept RangeOfFloats = std::ranges::range<R> && std::floating_point<...
Ben's user avatar
  • 9,953
1 vote
1 answer
110 views

Imagine a library has class templates A and B: template <template <class> class T> class A; template <class T, class U> class B; Now, if a user of the library wants to pass B as an ...
lobelk's user avatar
  • 531
0 votes
1 answer
101 views

I'm trying to write a little template function that returns sequential integer id's for templates passed to it. The following works for many templates, but not for templates that take non-type ...
Matthew Busche's user avatar
1 vote
2 answers
95 views

I have two related types (duck-typing), and another one that provides similar functionality with a different interface: namespace a { template<typename T> struct A final {}; using ...
Ðаn's user avatar
  • 11k
1 vote
2 answers
75 views

In C++, is there any way to ensure that two or more template type parameters are themselves template types with a common template type parameter? Let's say that I have this: struct ArbitraryType {}; ...
js87's user avatar
  • 13

15 30 50 per page
1
2 3 4 5
19