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 7039467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:48:07+00:00 2026-05-28T01:48:07+00:00

Hi all happy new year etc. I am having trouble with templating some function

  • 0

Hi all happy new year etc.

I am having trouble with templating some function pointer :

The code so far is as follows :

    template<class T>
    class EventMapper
    {
    private:
        typedef std::wstring const (T::*messageHandler)(std::wstring const & myMessage);                //!< Templated function pointer
        typedef std::tr1::unordered_map<std::wstring, messageHandler> umap;                             //!< abbreviation for eventHandler map container
        typedef umap::const_iterator eventCIt;                                                          //!< abbreviation for event map const_iterator
        typedef umap::iterator  eventIt;                                                                //!< abbreviation for event map iterator

        //test func ptr
        T const & myInstance;
        umap myEventMap;
        eventCIt myCurrentCommand;                                                                      //!< current selected command
    public:
        EventMapper( T const & instance_in) : myInstance(instance_in){}

        //register an event handler
        void registerHandler(std::wstring const & cmd_in, messageHandler handler_in)
        {
            this->myEventMap.insert(umap::value_type(cmd_in, handler_in));
        }

I get this error under MSVS 2008 SP1 :

Error   3   error C2146: syntax error : missing ';' before identifier 'eventCIt'    o:\AX_FusRecAlg\include\Reconstruction\JobListEditor\Types.h    19  AX.Services.Reconstruction.JobListDataProviderTest

Not very descriptive. Is what I am trying to do even possible? Any tips would be welcome! Thanks.

  • 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-28T01:48:07+00:00Added an answer on May 28, 2026 at 1:48 am

    To fix your code, use typename :

            typedef typename umap::const_iterator eventCIt;                                                          //!< abbreviation for event map const_iterator
            typedef typename umap::iterator  eventIt;
    

    For more information, look template dependent names

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Happy new year to you all! I am plotting some graphs and would like
Happy New Year. I have a bunch of SOAP Web Services. They all have
first of all an Happy New Year to all :) I have found that
First of all-many season-greetings and a happy new year to all of you! Have
Happy New Year Everyone! I have this existing php code I did when I
hope you all had a happy new year. So, my question is, what's the
Hello and Happy New Year all! While thinking about new project I decided to
First of all, Happy New Year to anybody out there reading this! I have
Happy Friday SO! I'm building a multi-WinForm application and am having some troubles. I
Happy New Year 2010 everyone :) Just getting back into the Flash groove, and

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.