vendredi 24 novembre 2017

Function of special template function

I have a structure template e.g.:

template<typename KEY_T, typename VAL_T> 
structure pair
{
    KEY_T key; VAL_T val;
};

VAL_T val may be the different (string, list or smth else) What I want is to overload the operator[] for the specified template structure pair<std::string, std::list>, and only for it. How is it possible?

P.S. I'm writing an Ini-parser and I want to access for settings like settings[Section][Key], where settings[Section] returns the pair<std::string, std::list<Entry>> and settings[Section][Key] then return the string from std::list<Entry>

Aucun commentaire:

Enregistrer un commentaire