0

Hey everyguys I've been taking a look at boost signals recently because I'd like to switch over to it from my own custom code for handling signal notification. I ran into a problem compiling the first example from here: http://www.boost.org/doc/libs/1_53_0/doc/html/signals2/tutorial.html, here is the example source code:

struct HelloWorld
{
  void operator()() const
  {
    std::cout << "Hello, World!" << std::endl;
  }
};

// Signal with no arguments and a void return value
boost::signals2::signal<void ()> sig;

// Connect a HelloWorld slot
HelloWorld hello;
sig.connect(hello);

// Call all of the slots
sig();

The problem that arose from attempting to compile this with: clang++ -std=c++11 signals2example.cpp is this error here:

 error: no matching function for call to 'get'
          func(std::get<indices>(args)...);

To narrow down the problem I commented out all the lines until I figured out which one caused it, it was the line that simply says "sig();" and the problem seems to be related to the std::get function which is for tuples or something. There are not many helpful posts online with regards to boost::signal2 and clang++ clashing. I should also note that g++ compiles this document with no complaints at all.

Steve
  • 194
  • 11
  • Without seeing the actual code I can only guess, but my guess is that in the example the `indices` name is a variable and not a compile-time constant. And templates are a compile-time only construct so all non-type template arguments must be compile-time constants. It seems weird that Boost would make such a mistake though. – Some programmer dude Jan 30 '14 at 06:55
  • @JoachimPileborg the performances of this library are not that great too; I'm not surprised by such a low level in terms of quality, I tried that library once, I can't see how and why there are people using this, there is literally no point. – user2485710 Jan 30 '14 at 07:11

1 Answers1

0

When you are compiling with Clang and you use the STL, the system STL (usually libstdc++) is used. It can be an old version (Do you use OSX?). Clang has perfect support for C++11 with libc++, try adding -stdlib=libc++ to the command line. You may also try to run both gcc and clang with -v and check the include paths to see which stdlib is used in each case.

Joky
  • 1,608
  • 11
  • 15