auto var = make_auto<double>();
    var.printTypes(); // prints double and int

    cout << typeid(var).name() << endl;

    cout << var << endl;

    int var2 = var;

    cout << var2 << endl;

 

 

d -> double
i -> int
11AutoWrapperIdiE -> AutoWrapper<double, int>
123 -> value
123 -> value


That's not bad at all, definitely you're smart.
👏

Outside block scope, that definitely can work,
But as soon as you put it inside a struct,
You will be obliged to add the template
parameters of AutoWrapper to the struct,
Which is not the desired effect. Which will break
any existing code.

Look at this example with the proposed
change in effect.

template<typename T>
int globalVar;

struct A{
using meta_int =
effective_decltype(globalVar<T>); // (int)<T>

meta_int m_data;

A(meta_int arg) : m_data(arg) {}

void printTypes() const
{
// this should print "i" for integer.
cout << typeid(m_data).name() << endl;
}
void introspection() const
{
using templ_type =
std::extract_1st_templ_type_t
<effective_decltype(m_data)>;
//at this stage m_data is fully constrcuted
// so its effective type has a resolved template
// parameter.
cout << typeid(templ_type).name() << endl;
};



As far as the constructor of A above is
concerned, it accepts argument
of apparent type int, but as soon as we
pass arguments with a signature like
the globalVar above it will capture an
effective type of this form (int)<T>

The type alias meta_int above, is just an int
with some extra meta data when needed.

With AutoWrapper class in your example,
You have to be intrusive, and any data member
of AutoWrapper type, imposes at any class to
be templated. Thus that class cannot be used
as a container template parameter.


This proposal can be summarized, with
the following:
An effective type is a regular apparent
type tagged with some meta data, if needed,
that only the compiler can make sense of and
manipulate, and will not change the behavior
of any existing program.



PS: Between me and you, for a moment i was
shocked, I thought you found the solution.
You are different, that's a fact ;-)