Compiling Error C2784, C2676 using STL

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: maersa (masa_iwasa_at_hotmail.com)
Date: 01/23/05

  • Next message: Arnaud Debaene: "Re: Compiling Error C2784, C2676 using STL"
    Date: Sun, 23 Jan 2005 09:02:46 +0800
    
    

    hi all,

    i'm getting an error when trying to insert items into a map.

    // define types....
    typedef std::basic_string< TCHAR > tstring;
    typedef std::map< tstring, tstring> STRINGMAP;
    typedef std::pair< tstring, tstring > StringPair;

    class A
    {
     .....
      STRINGMAP m_properties;
     .....
    }

    in my code i do the following....

    m_properties.insert( StringPair( _T("key"), _T("value") ) );

    and get the following errrors.
    -----------------------------------------------------------------------------------------------------------------
    c:\Program Files\Microsoft Visual Studio .NET
    2003\Vc7\include\functional(139): 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 tstring'
    c:\Program Files\Microsoft Visual Studio .NET
    2003\Vc7\include\functional(139): error C2784: 'bool std::operator <(const
    std::list<_Ty,_Alloc> &,const std::list<_Ty,_Alloc> &)' : could not deduce
    template argument for 'const std::list<_Ty,_Ax> &' from 'const tstring'
    c:\Program Files\Microsoft Visual Studio .NET
    2003\Vc7\include\functional(139): error C2784: 'bool std::operator <(const
    std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' :
    could not deduce template argument for 'const std::reverse_iterator<_RanIt>
    &' from 'const tstring'
    c:\Program Files\Microsoft Visual Studio .NET
    2003\Vc7\include\functional(139): 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 tstring'
    c:\Program Files\Microsoft Visual Studio .NET
    2003\Vc7\include\functional(139): error C2676: binary '<' : 'const tstring'
    does not define this operator or a conversion to a type acceptable to the
    predefined operator
    -----------------------------------------------------------------------------------------------------------------

    thanks in advance.


  • Next message: Arnaud Debaene: "Re: Compiling Error C2784, C2676 using STL"

    Relevant Pages

    • Re: Copying a CString to a std::string
      ... tstrings to account for Unicode vs. ANSI with something like: ... typedef wstring tstring; ... typedef wstringstream tstringstream; ... to namespace std or namespaces within namespace std unless otherwise ...
      (microsoft.public.vc.mfc)
    • Re: Copying a CString to a std::string
      ... tstrings to account for Unicode vs. ANSI with something like: ... typedef wstring tstring; ... typedef wstringstream tstringstream; ... it's undefined behaviour to extend namespace std. ...
      (microsoft.public.vc.mfc)
    • Re: Copying a CString to a std::string
      ... tstrings to account for Unicode vs. ANSI with something like: ... typedef wstring tstring; ... typedef wstringstream tstringstream; ...
      (microsoft.public.vc.mfc)
    • Re: Picking correct function depending on return type
      ... I have a typedef tstring like this: ... Now I would like to have conversion routines that convert from ... static tstring wstring2tstring(const std::wstring& src) ...
      (microsoft.public.vc.language)
    • Re: Copying a CString to a std::string
      ... tstrings to account for Unicode vs. ANSI with something like: ... typedef wstring tstring; ... typedef wstringstream tstringstream; ...
      (microsoft.public.vc.mfc)