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

Short version: Does an explicit instantiation declaration guarantee that a visible template definition is never used (unless an explicit instantiation definition is also encountered), and therefore ...
0 votes
1 answer
123 views

I'm trying to explicitly instantiate a forwarding constructor using C++20 with GCC 13.3 compiler in order not to put its definition in the header file. Here is a minimal example: Foo.h #pragma once ...
3 votes
1 answer
144 views

In order to hide template function definition in .cpp file, while having the forward declaration in a header file (function is used by a class template), the template has to be instantiated in order ...
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) #...
0 votes
0 answers
75 views

The short story is I am trying to have function templates and the main function in different compilation units like this (I am using g++ (GCC) 14.2.1 if it matters): // a.cpp template<typename T>...
0 votes
1 answer
75 views

Here's my attempt: The header defining the Foo template class and declaring but not defining a ctor only for a given value of the NTTP N, // foo.hpp #include <type_traits> template<int N>...
0 votes
1 answer
99 views

I am writing a c++ library where I deal with plenty of templated classes and free functions . Example (header + source file containing a free function): #ifndef MY_FUNCTION_HPP #define MY_FUNCTION_HPP ...
0 votes
0 answers
52 views

I have a templated library where all of my classes are explicitly instantiated and built into a static library. The library is structured like this: repo/ | - include/ | - mylib/ ...
0 votes
0 answers
28 views

I tried to build this C++ CMake project as DLL. Math.dll generated, but Math.lib did not generated. This is source code. Math.h #pragma once // Shared library import/export macro #ifdef _WIN32 #ifdef ...
0 votes
3 answers
160 views

I coded a message queue template in c++, and I want use it in many different projects, so that I put it into a namespace, for example my_lib. In order to prevent the codes from being compiled ...
2 votes
1 answer
172 views

Context In C++, we seem to be able to declare/define explicit function template instantiations after the function template has been referenced in another template function, if the other template ...
2 votes
2 answers
159 views

It is well known that when we want to have the declarations of templated class/functions in a header file and the their definition in a source cpp file, the must add explicit instantiation at the end ...
1 vote
0 answers
55 views

I have the following class with a static data member but linking failed with undefined reference to X<int, int>::list #include <vector> template < typename T1, typename T2 > class X ...
0 votes
1 answer
325 views

I have a templated C++ function: template<int i, int j> void foo(); I would like to define it in a .cpp file and instantiate it explicitely. The parameters i and j have the same admissible range ...
2 votes
1 answer
135 views

I have the following code: template <typename T> void fun(T t) { // foo and bar are not declared yet, but this is okay, // because they can be found through ADL for a class type T ...

15 30 50 per page
1
2 3 4 5
...
11

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