In the C++ language, implicit instantiation is the process of creating a class or function from a class template or function template when this particular type has not been explicitly instantiated.
Questions tagged [implicit-instantiation]
5 questions
12
votes
1 answer
Is use in an unused default member initializer still an odr-use?
Is use in a default member initializer still an odr-use, even if the default member initializer is not used by any constructor?
For example, is this program ill-formed because g is odr-used and therefore its definition implicitly…

user17732522
- 53,019
- 2
- 56
- 105
11
votes
1 answer
function template with unused template parameter
template
struct a
{
using type = int;
typename T::type i;
};
template>
void f1(T) {}
template::type>
void f2(T) {}
int main()
{
f1(1); // ok
f2(1);…

olist
- 877
- 5
- 13
10
votes
1 answer
Is a specialization implicitly instantiated if it has already been implicitly instantiated?
The question in the title is clear enough. To be more specific, consider the following example:
#include
template
struct is_complete_helper {
template
static auto test(U*) ->…

xskxzr
- 12,442
- 12
- 37
- 77
5
votes
1 answer
Does "used as non-type template parameter" make a function template implicitly instantiated?
I want to write a class template M that accepts incomplete type C as template parameter.
But I also want C has some traits when it is eventually defined.
Is this code guaranteed
to compile if defined(FLAG),
and to fail the compiling if…

zwhconst
- 1,352
- 9
- 19
2
votes
1 answer
Does `using` in a template class force instantiation?
This question is on how to use global variable initialization to achieve some side effect before main() is run (e.g., factory class registration before main()). This can be tricky when template is involved. Consider the following piece of…

Fei Liu
- 81
- 2