Visual Studio doesn't see the right constructor when I instantiate the template class. Where did I make a mistake?
I've already tried to make copy/move constructors explicit/deleted. Doesn't help.
#include <set>
using namespace std;
template <class T, template<class> class ConnectionType>
struct node
{
T value;
node(const T& value) : value(value) {}
set<ConnectionType<T>> connections;
};
template <class T>
struct connection
{
node<T, connection>* n;
connection(node<T, connection>* n) :
n(n) {}
bool operator<(const connection& b) const
{
return n < b.n;
}
};
int main()
{
node<int, connection> a(0);
connection<int> c(&a); // ERROR HERE
return 0;
}
Error:
error C2664: 'connection<T>::connection(connection<T> &&)': cannot convert argument 1 from 'node<int, connection> *' to 'node<T, connection<T>> *'
node<int, connection<int>> a(0);
instead? – EposConnectionType
is a template template parameter – Hafler/permissive-
doesn't help :( – Overcapitalizeconnection
being a short way of writingconnection<T>
inside the definition ofconnection<T>
, though I have no clue how to fix it – Hafler