X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b66c18380daff78efdc5edf3f6b563b34f36bdfc..680abdb047c1a66d3ccc14cad518117773c3cc8c:/include/xbt/functional.hpp diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index 5f530ea928..ca034ba73a 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -21,8 +21,8 @@ #include #include -#include -#include +#include "xbt/sysdep.h" +#include "xbt/utility.hpp" namespace simgrid { namespace xbt { @@ -39,11 +39,12 @@ public: {} void operator()() const { + char noarg[] = {'\0'}; const int argc = args_->size(); std::vector args = *args_; std::unique_ptr argv(new char*[argc + 1]); for (int i = 0; i != argc; ++i) - argv[i] = args[i].empty() ? const_cast(""): &args[i].front(); + argv[i] = args[i].empty() ? noarg : &args[i].front(); argv[argc] = nullptr; code_(argc, argv.get()); } @@ -78,7 +79,7 @@ constexpr auto apply(F&& f, Tuple&& t, simgrid::xbt::index_sequence) * * auto args = std::make_tuple(1, false); * int res = apply(foo, args); - * @encode + * @endcode **/ template constexpr auto apply(F&& f, Tuple&& t) @@ -231,9 +232,7 @@ private: vtable_ = &vtable; } - template - typename std::enable_if()>::type - init(F code) + template typename std::enable_if()>::type init(F code) { const static TaskVtable vtable { // Call: