I have an issue that I don't understand why it happens. In a nutshell, I would like to create a singleton to read a configuration file where each property will be stored in a map.
I defined my configuration class (.h) as
class Configuration {
public:
static Configuration* getInstance(std::string configFile);
private:
static std::map<std::string, std::string> properties;
static bool instanceFlag;
static Configuration *instance;
Configuration();
Configuration(std::string configFile);
~Configuration();
};
On the implementation class I have the following:
#include <iostream>
#include <fstream>
#include "Configuration.h"
std::map<std::string, std::string> Configuration::properties {};
bool Configuration::instanceFlag = false;
Configuration *Configuration::instance = NULL;
The issue is, my variable properties is the type of Configuration instead of a map. If a replace the key and value to be a int, the properties becomes a map. It seems weird.
Have you seen it before? What am I missing here?
Thanks Mauro
Aucun commentaire:
Enregistrer un commentaire