Angus Leeming <[EMAIL PROTECTED]> writes:

| Please excuse the dumm question, but is their a simple way to extract the 
| vector<string> from a vector<pair<<string, int> > ?
| 
| Eg, I have:
|       typedef std::pair<string, LyXFont::FONT_FAMILY> FamilyPair;
|       std::vector<FamilyPair> family;
| 
| And I'd like to do this:
|       std::vector<string> names = family.first;
| 
| Do I have to write a loop or is there a function I know nothing
| about?

        template<class Container>
        class ProxyCont {
                Container & container;
        public:
                myCont(Container & c) : container(c) {}
                void push_back(FamilyPair::value & v) {
                        container.push_back(v.first);
                }
        };
        
        std::vector<string> names;
        ProxyCont proxy(names);
        std::copy(family.begin(), family.end(), back_inserter(proxy));


Something likt this would work. The naming sucks...

        Lgb

Reply via email to