Boost logo

Boost Users :

From: A Arabadji (aa5899_at_[hidden])
Date: 2007-11-26 13:09:29


Hello people!

I am a new boost user, and I am trying to implement a console for a
game, which binds console commands to functions. These functions can
come from different objects and this is why I decided to try using boost.

I am using Visual Studio 8.0 SP1.

I have something like this:

//all functions are of generic structure
//the return nothing and they take a vector of arguments
typedef boost::function1< void, std::vector<std::string>& > funcHolder;

//I also have a hash table, which holds function references and the
//relative commands:

std::map<std::string, funcHolder> commands;

//Finally I have a function:
void Console::addCommand(const String &command, funcHolder f)
{
  std::map<String, funcHolder>::iterator t = commands.find(command);
  if(t == commands.end()) commands.insert( make_pair(command, f) );
  else commands[command] = f;
}

All of these things are members of a Console class. So once I added
these, I tried adding this line to the constructor:

addCommand("clear", boost::bind(&Console::clear, this);

//clear method
void Console::clear( vector<std::string>& args )
{
   lines.clear();
}

During compilation I get C4180 warnings. I have heard that those are due
to VS8.0 SP1 compiler bugs, so I ignore them but then I get a following
error:

Project : error PRJ0002 : Error result 1 returned from 'C:\Program
Files\Microsoft Visual Studio 8\VC\bin\cl.exe'.

Compiler basically crashes.

Any ideas what might be wrong?

I thank everyone in advance,
Artyom


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net