Ignore:
Timestamp:
2018-07-05T21:41:22Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a30c04d
Parents:
72f5379e
git-author:
Dzejrou <dzejrou@…> (2018-05-03 22:05:41)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:22)
Message:

cpp: added mem_fn

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/impl/functional.hpp

    r72f5379e r2c223a9d  
    786786     */
    787787
    788     // TODO: void should be /unspecified/
     788    namespace aux
     789    {
     790        template<class F>
     791        class mem_fn_t
     792        {
     793            // TODO: conditional typedefs
     794            public:
     795                mem_fn_t(F f)
     796                    : func_{f}
     797                { /* DUMMY BODY */ }
     798
     799                template<class... Args>
     800                decltype(auto) operator()(Args&&... args)
     801                {
     802                    return invoke(func_, forward<Args>(args)...);
     803                }
     804
     805            private:
     806                F func_;
     807        };
     808    }
     809
    789810    template<class R, class T>
    790     void mem_fn(R T::* f);
     811    aux::mem_fn_t<R T::*> mem_fn(R T::* f)
     812    {
     813        return aux::mem_fn_t<R T::*>{f};
     814    }
    791815
    792816    /**
Note: See TracChangeset for help on using the changeset viewer.