Skip to main content
1 vote
1 answer
110 views

I am using the following code for automatic vector/matrix template parameter deduction (I am particullarily interested in automatic deduction from passing initializer lists) template<class T, ...
Xenos's user avatar
  • 223
6 votes
1 answer
169 views

Consider the following example: struct S { template< typename T > operator T () { std::cout << __PRETTY_FUNCTION__; return T{}; } }; int main() { S s{}; ...
tommsch's user avatar
  • 778
0 votes
0 answers
59 views

Question for C++ (starting from C++11) language lawyers. Given the following trivial function template with a template parameter pack of integer values template <int ... Is, typename T> void foo ...
max66's user avatar
  • 67k
2 votes
1 answer
199 views

I'm running into an issue with function template specialization and return type deduction in C++. The following minimal example is meant to demonstrate the problem (https://godbolt.org/z/WT1Prnfh6): #...
user3612643's user avatar
  • 6,030
3 votes
1 answer
114 views

Is there a way to get this class to deduce the size of the internal array from a brace enclosed initialization list? #include <array> template <typename Key, typename Value, size_t N> ...
user1470475's user avatar
4 votes
1 answer
168 views

The following code compiles successfully with clang and gcc. Naively, I would have expected a2 to have type std::array<std::array<int, 1>, 1>. #include <array> auto a1 = std::array{...
MarkB's user avatar
  • 2,230
3 votes
2 answers
106 views

Given a wrapper type template <typename T> struct Ptr { Ptr(T*); }; a class hierarchy struct Base {}; struct Derived : Base {}; and a set of function overloads void f(Ptr<Base>); ...
Michael Deom's user avatar
0 votes
1 answer
54 views

Example code could be found below or on compiler explorer. All 3 cases are allowed by gcc while SVariadicTemplate<S>::foo is rejected by clang and MSVC. Which compiler is correct on this case? #...
wanghan02's user avatar
  • 1,339
6 votes
1 answer
85 views

I'm trying to write a set of util functions simplifying work with bit flags. One of them is template< typename Flags > void toggleFlag( Flags & targetFlags, Flags flagToSet, bool enabled ) { ...
Youda008's user avatar
  • 2,129
2 votes
1 answer
125 views

There appears to be a discrepancy in how templated function overloads are resolved and how non-templated function overloads are resolved, but there seem to be some cases where it should not make a ...
John Grzegorczyk's user avatar
2 votes
1 answer
122 views

I have the following two functions, but I always get this compiler error: deduced conflicting types for parameter 'T' I figure that the problem is that T refers to an array and int at the same time, ...
Iván's user avatar
  • 23
2 votes
0 answers
37 views

I have a class structured like this, where FixedStr is implicitly constructible from a string-literal: template<FixedStr K, class... T> struct ParserCtx { Parser<T...> parser; ...
David Spry's user avatar
0 votes
2 answers
101 views

why template argument missing in print_all(arr&) is valid but not in f(std::vector&) ? source code link. What am I missing ? please explain what happens when we compile ? template<typename ...
Jitu DeRaps's user avatar
0 votes
1 answer
106 views

I'm trying to make a complete concept is_derived_from_template where we take some typename DerivedSubject and some template<typename...> typename BasePredicate and see if DerivedSubject derives ...
AMDG's user avatar
  • 1,212
0 votes
1 answer
48 views

Trying to create a JobProcessor that can execute any Job using packaged_task: class JobProcessor { public: JobProcessor(uint8_t numThreads = 8); template<class Fn, class... ...
vegalock's user avatar

15 30 50 per page
1
2 3 4 5
51