Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
13 votes
1 answer
236 views

Consider the following example from [temp.inst.3]: template<class T> struct C { void f() { T x; } void g() = delete; }; C<void> c; // OK, definition of C<void&...
0 votes
1 answer
81 views

Consider the following class template. template<template<typename U> typename T> class Entity { // Something }; What is the proper syntax to specialize Entity explicitly: by U, by T (...
1 vote
1 answer
142 views

I am having issues in understanding and fixing a compiler error that I see with MinGW (UCRT64) C++20, but that I don't see when I build the code with MSBuild C++11. header.h: (Only relevant code) #...
3 votes
1 answer
154 views

I wrote the following snippet that compiles with clang but gcc and msvc rejects it. Demo #include <iostream> #include <iomanip> //wrapper template<typename T> struct Wrapper { ...
0 votes
1 answer
48 views

Suppose the following class: class JsonDocument { public: using RootType = size_t; constexpr static RootType ObjectRoot = 1; constexpr static RootType ArrayRoot = 2; template< ...
6 votes
1 answer
239 views

Consider the following code: #include<concepts> template<typename> void foo() { } template<std::integral> void foo() { } template<> void foo<bool>() { } int main() {...
4 votes
1 answer
178 views

The use case is for a subclass of std::expected, but the following reproduces the behaviour I'm interested in. #include <type_traits> template<class T> struct Foo{ T value; constexpr ...
0 votes
1 answer
243 views

I think some of my confusion over what "Specialization" means is that it appears to have two related, though distinct meanings. These are the two definitions I've seem to come across: From ...
0 votes
2 answers
84 views

#include <iostream> #include <string> #include <typeinfo> using namespace std; template<class T> T maxn(T* a,int n); template<> void maxn(const char* s[],int n); int ...
0 votes
3 answers
99 views

I was writing an example involving specialization of class template where I noticed that the standard allows two different syntax for specialization of a data member as shown below: template<...
0 votes
0 answers
36 views

I have an implementation of a class template with a base class. class MyBase { protected: virtual void getErrorPercent(std::ostream& fileStream) = 0; virtual void getFormattedText(std::...
18 votes
2 answers
368 views

template<class T> void fun(T){} template<> int fun(int){return 0;} Consider this example, it is rejected by all implementations. However, I haven't found any persuasive provision in the ...
0 votes
1 answer
309 views

I have a member func template as following: using ArgValue_t = std::variant<bool, double, int, std::string>; struct Argument_t { enum Type_e { Bool, Double, Int, String, VALUES_COUNT }; ...
1 vote
1 answer
905 views

I am trying the following... #include <iostream> using namespace std; template<class T> class Singleton { private: class InstPtr { public: InstPtr() : m_ptr(0) {} ...
1 vote
1 answer
295 views

Recently I was learning OpenGL basics from YouTube and while I was working with VS C++ compiler, everything worked like a charm, but since I moved to Clang I get error "explicit specialization in ...

15 30 50 per page
1
2 3 4 5 6

AltStyle によって変換されたページ (->オリジナル) /