#include <utility>
#include <vector>
-#include <xbt/sysdep.h>
-#include <xbt/utility.hpp>
+#include "xbt/sysdep.h"
+#include "xbt/utility.hpp"
namespace simgrid {
namespace xbt {
{}
void operator()() const
{
+ char noarg[] = {'\0'};
const int argc = args_->size();
std::vector<std::string> args = *args_;
std::unique_ptr<char*[]> argv(new char*[argc + 1]);
for (int i = 0; i != argc; ++i)
- argv[i] = args[i].empty() ? const_cast<char*>(""): &args[i].front();
+ argv[i] = args[i].empty() ? noarg : &args[i].front();
argv[argc] = nullptr;
code_(argc, argv.get());
}
*
* auto args = std::make_tuple(1, false);
* int res = apply(foo, args);
- * @encode
+ * @endcode
**/
template <class F, class Tuple>
constexpr auto apply(F&& f, Tuple&& t)
vtable_ = &vtable;
}
- template<class F>
- typename std::enable_if<!canSBO<F>()>::type
- init(F code)
+ template <class F> typename std::enable_if<not canSBO<F>()>::type init(F code)
{
const static TaskVtable vtable {
// Call:
[](TaskUnion& buffer, Args... args) -> R {
// Delete F when we go out of scope:
std::unique_ptr<F> code(*reinterpret_cast<F**>(&buffer));
- (*code)(std::forward<Args>(args)...);
+ return (*code)(std::forward<Args>(args)...);
},
// Destroy:
[](TaskUnion& buffer) {