#75 Patch for libc++/C++11 implicit sp conversion to bool

None
closed-fixed
None
5
2013-06-03
2013-04-27
No

This allows ql-1.2.1 to compile correctly under Apple LLVM 4.2 with C++11/libc++

1 Attachments

Discussion

  • Luigi Ballabio

    Luigi Ballabio - 2013-05-10

    Thanks for the patch. What was the error? Would an explicit conversion to bool work, instead of comparing to NULL?

     
  • Scott Condit

    Scott Condit - 2013-05-11

    The error is that boost [and the standard library] will disallow sp implicit conversion to bool in C++11. I tend to write the comparison against NULL idiomatically for C++<11 - pending an eventual move to C++11 nullptr.

    However if you dislike the NULL comparison - any of
    1 an implicit conversion from .get()
    2 static_cast<bool>
    3 !!ptr
    should work. It might make sense to combine this anyway with e.g. conditional selection of std::shared_ptr/dynamic_pointer_cast/ref rather than the boost types, - if you let me know what you prefer, I'll redo the patch.

     
  • Luigi Ballabio

    Luigi Ballabio - 2013-05-13

    Apologies for being a pain, but wouldn't an explicit conversion to bool, as in

    return bool(boost::dynamic_pointer_cast<CPICouponPricer>(pricer));
    

    also work? The standard library mandates an explicit operator bool(), and boost seems to implement it.

     
  • Luigi Ballabio

    Luigi Ballabio - 2013-06-03

    I've committed to the svn trunk a change that makes the conversion to bool explicit.
    Let me know if there's still a problem with that.
    Thanks again for the heads-up.

     
  • Luigi Ballabio

    Luigi Ballabio - 2013-06-03
    • status: open --> closed-fixed
    • Group: -->
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks