خرید بک لینک

Vote count: 0

I have a map from string to string, for example, the map have 4 entries, the keys are: a.b.c, a.b.d, a.b, a.e and the values are 1, 2, 3, 4 respectively.

std::map<string, string> myMap;
myMap["a.b.c"] = "1";
myMap["a.b.d"] = "2";
myMap["a.b"] = "3";
myMap["a.e"] = "4";

Now I would like to build a string in a hierarchy format:

string myFunc(const std::map<string, string>& m)
{
    //the implementation?
}

Then I test with:

string myString = myFunc(myMap);

myString could be like:

a(b(c=1, d=2), b=3, e=4)

Note: the order of the comma separated items are not important.

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 12 فروردين 1395 ساعت: 8:37

صفحه بندی