diff --git a/fluent++/Callback.h b/fluent++/Callback.h index cdb3eb7..84e8bb8 100644 --- a/fluent++/Callback.h +++ b/fluent++/Callback.h @@ -49,7 +49,7 @@ namespace detail }; template - using unwrap_callback = do_unwrap_callback<::fu::argument_type_t<_CTy>>; + using unwrap_callback = do_unwrap_callback<::fu::argument_type_of_t<_CTy>>; } // detail @@ -63,11 +63,11 @@ template using weak_callback_of_t = typename detail::unwrap_callback<_CTy>::WeakCallbackType; template -typename shared_callback_of_t<_CTy> +inline typename shared_callback_of_t<_CTy> make_shared_callback(_CTy&& callback) { return std::make_shared> (std::forward>(callback)); } -#endif /// _TASK_SCHEDULER_H_ +#endif /// _CALLBACK_H_ diff --git a/fluent++/CallbackContainer.h b/fluent++/CallbackContainer.h new file mode 100644 index 0000000..4588b9a --- /dev/null +++ b/fluent++/CallbackContainer.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2008-2015 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef _CALLBACK_CONTAINER_H_ +#define _CALLBACK_CONTAINER_H_ + +#include + +#include "Callback.h" + +class CallbackContainer +{ + size_t current_handle; + + std::unordered_map container; + +public: + template + _CTy operator()(_CTy&& callback) + { + return callback; + } +}; + +#endif /// _CALLBACK_CONTAINER_H_ diff --git a/fluent++/functional_unwrap.hpp b/fluent++/functional_unwrap.hpp index f36fd0e..5af50c0 100644 --- a/fluent++/functional_unwrap.hpp +++ b/fluent++/functional_unwrap.hpp @@ -114,22 +114,22 @@ namespace fu /// Trait which defines the return type of the function. template - using return_type_t = + using return_type_of_t = typename detail::select_best_unwrap::type::return_type; /// Trait which defines the argument types of the function packed in std::tuple. template - using argument_type_t = + using argument_type_of_t = typename detail::select_best_unwrap::type::argument_type; /// Trait which defines the std::function type of the function. template - using function_type_t = + using function_type_of_t = typename detail::select_best_unwrap::type::function_type; /// Trait which defines the function pointer type of the function. template - using function_ptr_t = + using function_ptr_of_t = typename detail::select_best_unwrap::type::function_ptr; } // fu diff --git a/test.cpp b/test.cpp index 01b42af..9407c20 100644 --- a/test.cpp +++ b/test.cpp @@ -2,6 +2,7 @@ #include "fluent++.hpp" #include "Callback.h" +#include "CallbackContainer.h" void CastSpell(int id, Callback const& callback) { @@ -50,5 +51,11 @@ int main(int argc, char** argv) { }); + CallbackContainer callback; + + auto mycb = callback([] + { + }); + return 0; }