2

I have tried to use clang 3.0 with libc++ and C++0x.

I have compile the boost 1.48 with libc++, according to How to compile/link Boost with clang++/libc++? The boost/signals is broken.

So, I am looking for a replacement of boost/signals, and the Jae's Fast Delegate looks good, except it depends of an early version of boost.

#include <boost/pending/ct_if.hpp>

The file above was removed on 1.48.

So, is there an other candidate multi-cast delegate/signals works with clang 3.0 and C++0x?

Community
  • 1
  • 1
Logan
  • 165
  • 11
  • 1
    Why are you trying to replace Boost.Signals? Shouldn't you be trying to get it to *work*? – Nicol Bolas Feb 20 '12 at 18:10
  • Hi, thank you for your comment. @NicolBolas According to http://lwg.github.com/issues/lwg-active.html#2059 It is almost impossible to fix. – Logan Feb 20 '12 at 18:36
  • @Logan: Why is adding a `static_cast` to the calls to `erase` problematic? – Howard Hinnant Feb 20 '12 at 18:38
  • @HowardHinnant According to the url, the const_iterator make some kind of ambiguousness. `This breaks code where the map's key_type has a constructor which accepts an iterator (for example a template constructor), as the compiler cannot choose between erase(const key_type&) and erase(const_iterator).` – Logan Feb 20 '12 at 18:51
  • 1
    @Logan: Ah, sorry for the confusion. That comment refers to a resolution of having the vendor supply both iterator and const_iterator overloads of erase. If the client converts the iterator to a const_iterator at the point of calling erase, there is no ambiguity. The code will just work. – Howard Hinnant Feb 20 '12 at 18:56
  • @HowardHinnant Got it, and thank you. I'll try to fix the boost::signals later. – Logan Feb 20 '12 at 19:17

2 Answers2

1

Just replace boost::ct_if with boost::mpl::if_c (and #include <boost/mpl/if.hpp>) in Jae's Fast Delegate code.

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • 1
    I looked at Jae's code where it used ct_if, looked at the old definition of that in Boost, and I happened to know that Boost MPL has something very similar. Fun fact: `` is the actual "replacement" for ct_if, but I pointed you to the MPL version because it is more similar to ct_if, and is not a "detail" so not likely to go away anytime soon. – John Zwinck Feb 20 '12 at 19:05
0

http://www.boost.org/doc/libs/1_49_0/doc/html/signals2.html

Signals2 is header only, and included with boost. It has a few nice extra features like being thread-safe.

Edit: Looks like there's a bug in the current version of signals2 that prevents it from working with clang. According to this answer it'll be fixed in boost 1.50

Community
  • 1
  • 1
Chris Devereux
  • 5,453
  • 1
  • 26
  • 32