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

  • Home
  • SEARCH
  • 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 6847411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:44:29+00:00 2026-05-27T00:44:29+00:00

1>c:\program files\microsoft visual studio 10.0\vc\include\map(229): warning C4180: qualifier applied to function type has no

  • 0
1>c:\program files\microsoft visual studio 10.0\vc\include\map(229): warning C4180: 
     qualifier applied to function type has no meaning; ignored
1>          d:\...\gmproject.h(122) 
            : see reference to class template instantiation 'std::map<_Kty,_Ty>' 
            being compiled
1>          with
1>          [
1>              _Kty=GMProject::DuplicateTy,
1>              _Ty=GMProject::DuplicateFn
1>          ]

Well my class has these typedefs (pTree is a container):

typedef void *DuplicateFn(pTree&, const pTree&); 
enum DuplicateTy {
    SKIP,
    OVERWRITE,
    ASK
};

typedef std::map<DuplicateTy, DuplicateFn> DuplicateMapTy;

And lines 122,123 are:

static const DuplicateMapTy DuplicateFns;
static DuplicateMapTy DuplicateFns_INIT();

How do I indicate this map can’t change – and makes it static to the class?
My goal is to create a map so I can “get” a function pointer from the enumerate. (The client code will provide the enum, then the class itself resolves the enum to a function).

  • 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-27T00:44:30+00:00Added an answer on May 27, 2026 at 12:44 am

    The issue has nothing to do with the map being const: it’s a warning because the returntype of the const version of std::map::at() is const mapped_type&. This code produces the warning just as well:

    typedef void *DuplicateFn();
    
    typedef std::map< int, DuplicateFn > DuplicateMapTy;
    
    DuplicateMapTy DuplicateFns;
    

    The retrun type of map’s at here is

    const DuplicateFn&
    

    While this warning has it’s place (although I’m not too sure in this particular situation it is justified by the standard), in this case there should be no harm to disable it locally for the code using the map, or if you do not like the pragma hassle, wrap your function pointer into a simple struct.

    edit as Gorpik points out in the comment below, this is actually generated at that specific location though the function isn’t used. Seems indeed the VS compiler is kind of aggressive when hunting for warnings: it does consider declarations.

    template< class T >
    struct CheckMe
    {
      const T& at() //warning C4180 pops up
      {
        //gets not instantiated hence no error for missing returntype
      }
    };
    
    CheckMe< DuplicateFn > check;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This and this. c:\Program Files\Microsoft Visual Studio 9.0\VC\crt\src\sstream c:\Program Files\Microsoft Visual Studio 9.0\VC\include\sstream And
Error 3 error C2059: syntax error : ')' c:\program files\microsoft visual studio 10.0\vc\include\string 758
MFC File: winctrl4.cpp (C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\src\mfc) CString CRichEditCtrl::GetSelText() const { ASSERT(::IsWindow(m_hWnd)); CHARRANGE
I read that defined styles are located at C:\Program Files\Microsoft Office\Office12\Bibliography\Style I use ISO
When I try opening a file it tries to use C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0
I have a folder on my hard drive, C:\Program Files\Microsoft SDKs, and I was
when I write in commandline in windows: C:\Program Files (x86)\Microsoft Office\Office12>winword.exe /mOpenPage c:\Navod ilo.doc
Tying to compile the following program with Visual Studio 10, I get lot of
With the Visual Studio 2005 C++ compiler , I get the following warning when
As per http://msdn.microsoft.com/en-us/library/h21twfw7(v=VS.100).aspx (for Visual Studio 2010) strstreambuf is deprecated. I was of the

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.