Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7610961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:32:49+00:00 2026-05-31T01:32:49+00:00

Here is my code. class xyz. #include <iostream> #include <vector> #include <map> using namespace

  • 0

Here is my code.

class xyz.

#include <iostream>
#include <vector>
#include <map>

using namespace std;

typedef map<std::string,std::pair<std::string,vector<int>>> MapPairList;

class xyz
{
private:
    MapPairList m1;

public:
    void insert();
    string GetType(string& filetype);
    vector<int> GetExtList(string& filetype);
};

Implementation of above class.

    #include "xyz.h"

void xyz::insert()
{
    vector<int> v1;
    v1.push_back(1);
    v1.push_back(2);
    v1.push_back(3);

    vector<int> v2;
    v2.push_back(1);
    v2.push_back(2);
    v2.push_back(3);

    vector<int> v3;
    v3.push_back(1);
    v3.push_back(2);
    v3.push_back(3);

    string c1 = "type1";
    string f1 ="filetype1";
    string c2 = "type2";
    string f2 ="filetype2";
    string c3 = "type3";
    string f3 ="filetype3";

    m1.insert(make_pair(f1,make_pair(c1,v1)));
    m1.insert(make_pair(f2,make_pair(c2,v2)));
    m1.insert(make_pair(f3,make_pair(c3,v3)));
}

string xyz::GetType(std::string &filetype)
{
    MapPairList::iterator iter = m1.find(filetype);

    if(iter != m1.end())
    {
        return (*iter).second.first;
    }
}

vector<int> xyz::GetExtList(std::string &filetype)
{
    MapPairList::iterator iter = m1.find(filetype);

    if(iter != m1.end())
        return (*iter).second.second;
}

int main()
{
    xyz *x = new xyz();

    string out("filetype1");
    string in = x->GetType(out);
    cout<<in.c_str();

    delete x;
    return 0;
}

And when I try to compile I get following errors:

1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\xtree(1372) : see declaration of 'std::operator <'
1>        c:\program files\microsoft visual studio 8\vc\include\functional(142) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const'
1>        with
1>        [
1>            _Ty=std::string
1>        ]
1>        c:\program files\microsoft visual studio 8\vc\include\map(72) : see reference to class template instantiation 'std::less<_Ty>' being compiled
1>        with
1>        [
1>            _Ty=std::string
1>        ]
1>        c:\program files\microsoft visual studio 8\vc\include\xtree(26) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
1>        with
1>        [
1>            _Kty=std::string,
1>            _Ty=std::pair<std::string,std::vector<int>>,
1>            _Pr=std::less<std::string>,
1>            _Alloc=std::allocator<std::pair<const std::string,std::pair<std::string,std::vector<int>>>>,
1>            _Mfl=false
1>        ]
1>        c:\program files\microsoft visual studio 8\vc\include\xtree(68) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
1>        with
1>        [
1>            _Traits=std::_Tmap_traits<std::string,std::pair<std::string,std::vector<int>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::pair<std::string,std::vector<int>>>>,false>
1>        ]
1>        c:\program files\microsoft visual studio 8\vc\include\xtree(94) : see reference to class template instantiation 'std::_Tree_ptr<_Traits>' being compiled
1>        with
1>        [
1>            _Traits=std::_Tmap_traits<std::string,std::pair<std::string,std::vector<int>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::pair<std::string,std::vector<int>>>>,false>
1>        ]
1>        c:\program files\microsoft visual studio 8\vc\include\xtree(112) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
1>        with
1>        [
1>            _Traits=std::_Tmap_traits<std::string,std::pair<std::string,std::vector<int>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::pair<std::string,std::vector<int>>>>,false>
1>        ]
1>        c:\program files\microsoft visual studio 8\vc\include\map(82) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1>        with
1>        [
1>            _Traits=std::_Tmap_traits<std::string,std::pair<std::string,std::vector<int>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::pair<std::string,std::vector<int>>>>,false>
1>        ]
1>        c:\documents and settings\apoos\my documents\visual studio 2005\projects\algos\maplistpair\xyz.h(12) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1>        with
1>        [
1>            _Kty=std::string,
1>            _Ty=std::pair<std::string,std::vector<int>>
1>        ]
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\xtree(1372) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\xtree(1372) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\xtree(1372) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\vector(1276) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\vector(1276) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\vector(1276) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\vector(1276) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\xutility(1880) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\xutility(1880) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\xutility(1880) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\xutility(1880) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\utility(76) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\utility(76) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\utility(76) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1>        c:\program files\microsoft visual studio 8\vc\include\utility(76) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 8\vc\include\functional(143) : error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator

Actually I am trying to use only the specific data structure.

If you have a better solution to replace this data structure with other one please suggest that. Mapping of element is container is one to one between 1st two string. And one to many between the element in the pair.That is why last element in the pair is a vector.
Can any one tell me what went wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:32:50+00:00Added an answer on May 31, 2026 at 1:32 am

    g++ says error: ‘>>’ should be ‘> >’ within a nested template argument list

    Change your typedef to:

    typedef map<std::string,std::pair<std::string,vector<int> > > MapPairList;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here's the code: class Acount { int sum ; String owner ; //these seem
Here's the code: class qual { public static int fibonacci(int n) { if (n
Here is the code: class Time { public static void printTime (int hour, int
Here is my code: class Soldier { public: Soldier(const string &name, const Gun &gun);
In the following code: public class A { public A():this(null){} public A(string b){/*code here*/}
here is the code (java): class prime { public static boolean prime (int a,
Here's my code: class Ramka extends JFrame { public static final int SZEROKOSC =
Here is my code: class Array def anotherMap self.map {yield} end end print [1,2,3].anotherMap{|x|
Here is the code I'm using. public class timerApp { Runnable timerRun = new
Here's my code: class Publisher(models.Model): name = models.CharField( max_length = 200, unique = True,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.