Thread: Pairing Woes...

  1. #1
    Registered User
    Join Date
    May 2007

    Pairing Woes...

    Hey all,

    I've been writing a nice & simple scripting system, and so far have been doing pretty well, except for the multitude of complilation errors (just simple mistakes )..

    My main issue is that I'm using std::map as a table of commands, with a key, and a function pointer to process the command.
    The problem comes with using insert() to add a new element, in particular, the make_pair function.

    Here's the code:
    void Machine::Command(std::string key, bool *FuncReference(std::string, Stack))
        _commands.insert( make_pair(key, FuncReference));
    And the error:
    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_pair.h:74: error: field `std::pair<const std::string, bool*()(std::string, Stack)>::second' invalidly declared function type
    I'm really quite stuck with this. Maybe because I haven't slept in 4 days, but hey...

    I'll keep screwing around with this thing, right after I get some sleeeep.. Help is still appreciated though.


  2. #2
    Join Date
    Jan 2002
    bool (*FuncReference)(std::string, Stack)
    Function pointers.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    May 2007
    Ergh, Sorry... That Copy & Paste was from an older file saved on my Harddrive. Turns out I am using the syntax you suggested above, queerest thing is, I still get the error....

  4. #4
    Registered User
    Join Date
    Jan 2005
    Can you post the simplest, smallest complete example that demonstrates the problem?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Device context woes
    By samGwilliam in forum Windows Programming
    Replies: 13
    Last Post: 04-16-2005, 10:01 PM
  2. Ugh, ComboBox Woes
    By Zeusbwr in forum Windows Programming
    Replies: 11
    Last Post: 04-11-2005, 11:14 PM
  3. Doc/view woes fixed
    By VirtualAce in forum Windows Programming
    Replies: 4
    Last Post: 04-08-2005, 09:40 AM
  4. strstr woes
    By magis in forum C++ Programming
    Replies: 6
    Last Post: 04-02-2005, 10:03 PM
  5. Exception Handling Class Woes
    By ventolin in forum C++ Programming
    Replies: 1
    Last Post: 03-31-2005, 08:37 PM