X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/901293dfbce6b7e0f555dbdc53358aa347fd1a3d..1643b1711d3403b8c3ae7091e38cb69f5f9a1272:/include/xbt/functional.hpp diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index a0c4f26500..a8a7ad6e07 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -51,46 +51,12 @@ public: code_(argc, nullptr); } }; -class MainStdFunction { -private: - void (*code_)(std::vector); - std::shared_ptr> args_; - -public: - MainStdFunction(void (*code)(std::vector), std::vector args) - : code_(std::move(code)), args_(std::make_shared>(std::move(args))) - { - } - void operator()() const - { - std::vector args = *args_; - code_(args); - } -}; - -template -inline XBT_ATTRIB_DEPRECATED_v323("Please use wrap_main()") std::function wrapMain( - F code, std::vector args) -{ - return MainFunction(std::move(code), std::move(args)); -} template inline std::function wrap_main(F code, std::vector args) { return MainFunction(std::move(code), std::move(args)); } -inline std::function wrap_main(void (*code)(std::vector), std::vector args) -{ - return MainStdFunction(std::move(code), std::move(args)); -} -template -inline XBT_ATTRIB_DEPRECATED_v323("Please use wrap_main()") std::function wrapMain(F code, int argc, - const char* const argv[]) -{ - std::vector args(argv, argv + argc); - return MainFunction(std::move(code), std::move(args)); -} template inline std::function wrap_main(F code, int argc, const char* const argv[]) { std::vector args(argv, argv + argc); @@ -320,20 +286,21 @@ public: } }; -template -XBT_ATTRIB_DEPRECATED_v323("Please use make_task()") auto makeTask(F code, Args... args) - -> Task +template auto make_task(F code, Args... args) -> Task { TaskImpl task(std::move(code), std::make_tuple(std::move(args)...)); return Task(std::move(task)); } -template auto make_task(F code, Args... args) -> Task +// Deprecated +template +XBT_ATTRIB_DEPRECATED_v323("Please use make_task()") auto makeTask(F code, Args... args) + -> Task { TaskImpl task(std::move(code), std::make_tuple(std::move(args)...)); return Task(std::move(task)); } -} -} +} // namespace xbt +} // namespace simgrid #endif