-
Notifications
You must be signed in to change notification settings - Fork 70
I am going to build my own function with move semantics and polymorphism #1291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
base/function.hpp
Outdated
template<typename F, typename Result, typename... Args> | ||
class ConcreteFunctor final : public Functor<Result, Args...> { | ||
public: | ||
explicit ConcreteFunctor(F Functor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F functor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
base/function.hpp
Outdated
}; | ||
|
||
template<typename Signature> | ||
struct function; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
base/function_body.hpp
Outdated
namespace internal_function { | ||
|
||
template<typename F, typename Result, typename... Args> | ||
ConcreteFunctor<F, Result, Args...>::ConcreteFunctor(F Functor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F functor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
base/function.hpp
Outdated
class Functor { | ||
public: | ||
virtual ~Functor() = default; | ||
virtual Result call(Args&&...) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call
, maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
}; | ||
function<void()> f = std::move(λ); | ||
f(); | ||
EXPECT_THAT(observe_i, Eq(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPECT_EQ
(several places)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
No description provided.