X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/224a19c5c06a8b600908ec3465cdbb578d50108e..377d2091c1e0f30ef48fb068f672ae624ad59d0f:/include/xbt/functional.hpp diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index 2429b5bf0a..10c16bf98a 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -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) @@ -240,7 +241,7 @@ private: [](TaskUnion& buffer, Args... args) -> R { // Delete F when we go out of scope: std::unique_ptr code(*reinterpret_cast(&buffer)); - (*code)(std::forward(args)...); + return (*code)(std::forward(args)...); }, // Destroy: [](TaskUnion& buffer) {