I apologize if my title is confusing. What I'm trying to do is create a class template implementing the std::map from scratch. What I want to achieve is to not use specific data types in the template arguments. Please see the code below:
#include "pch.h"
#include <iostream>
#include <string>
using namespace std;
template<typename T, typename N>
class MyCustomMap{
public:
MyCustomMap();
T* keys;
N* values;
};
template<typename T, typename N>
MyCustomMap<T, N>::MyCustomMap(){
this->keys = new T[10];
this->values = new N[10];
}
....
....
int main(){
MyCustomMap<int,string> map; //This works because I specified the argument list
MyCustomMap map; //This is my goal
// The main goal is to call Insert one after another with different data types
map.Insert(1, "Test");
map.Insert("Test2", 2);
return 0;
}
Is this possible? Any help is appreciated, thank you.