X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f021bb7ffaa82cc31dcfe9ccc8d1c34fd1940102..cf0ebedfe4a6fd8a14784135e912725b7e027d6f:/include/xbt/functional.hpp diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index 8b73dabeaf..4b5f0afc10 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2015-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -6,6 +6,9 @@ #ifndef XBT_FUNCTIONAL_HPP #define XBT_FUNCTIONAL_HPP +#include +#include + #include #include #include @@ -20,9 +23,6 @@ #include #include -#include "xbt/sysdep.h" -#include "xbt/utility.hpp" - namespace simgrid { namespace xbt { @@ -52,14 +52,26 @@ public: } }; -template inline -std::function wrapMain(F code, std::vector 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)); } -template inline -std::function wrapMain(F code, int argc, const char*const argv[]) +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); return MainFunction(std::move(code), std::move(args)); @@ -288,14 +300,19 @@ public: } }; -template -auto makeTask(F code, Args... args) --> Task< decltype(code(std::move(args)...))() > +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)); } +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)); +} } }