Coder Social home page Coder Social logo

Why mark delegate.h as obsolete about generic HOT 7 CLOSED

yxbh avatar yxbh commented on June 29, 2024
Why mark delegate.h as obsolete

from generic.

Comments (7)

user1095108 avatar user1095108 commented on June 29, 2024 1

Also check out anyfunction.cpp and the crl library, if you're interested in delegates, signals and slots.

from generic.

user1095108 avatar user1095108 commented on June 29, 2024 1

If you want an example for something, just tell me and I'll write one.

from generic.

user1095108 avatar user1095108 commented on June 29, 2024

I use the new forwarder.hpp mostly as most std::function implementations have improved to the point where I thought the old delegate.hpp was obsolete.

from generic.

user1095108 avatar user1095108 commented on June 29, 2024

Don't forget anyfunction.hpp as well. It's the best thing.

from generic.

yxbh avatar yxbh commented on June 29, 2024

Ok, cool! Thanks . I will definitely check them out! :)

from generic.

yxbh avatar yxbh commented on June 29, 2024

I've finally had some time off work to have a look at any_function and wow it is amazing the kind of things you can do with it :o

However, it doesn't look like it supports equality comparison which delegate does.

Also, the current version of delegate.hpp incorrectly fails the equality comparison between two delegate that were constructed from the same inlined function. Adding the following code into operator== fixes the problem. I believe that was actually there a long time ago but it was then removed?

if (store_size_ && rhs.store_size_)
    return (std::memcmp(store_.get(), rhs.store_.get(), store_size_) == 0) && (stub_ptr_ == rhs.stub_ptr_);

I really want to thank you for making these source code open sourced. I've learnt so much about C++ from your library!

from generic.

user1095108 avatar user1095108 commented on June 29, 2024

ok, I'll add since it's already obsolete :) Adding memcmp into c++ is a bad idea though. It works on your platform, but how about some other? Delegates are in general very weak when it comes to comparisons.

from generic.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.