X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ab1a5770e72e90720fb1f2dc0901cda2573b208b..e71a2a302d28430dc1bfee906f842f5f3d0fa3ce:/include/xbt/automaton.hpp diff --git a/include/xbt/automaton.hpp b/include/xbt/automaton.hpp index 8b3827db57..01bd9e0863 100644 --- a/include/xbt/automaton.hpp +++ b/include/xbt/automaton.hpp @@ -1,11 +1,11 @@ -/* Copyright (c) 2015. The SimGrid Team. +/* Copyright (c) 2015-2021. 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. */ -#ifndef _XBT_AUTOMATON_HPP -#define _XBT_AUTOMATON_HPP +#ifndef XBT_AUTOMATON_HPP +#define XBT_AUTOMATON_HPP #include @@ -19,11 +19,9 @@ namespace xbt { * This API hides all the callback and dynamic allocation hell from * the used which can use C++ style functors and lambda expressions. */ -template -xbt_automaton_propositional_symbol_t add_proposition( - xbt_automaton_t a, const char* id, F f) +template xbt_automaton_propositional_symbol_t add_proposition(const_xbt_automaton_t a, const char* id, F f) { - F* callback = new F(std::move(f)); + auto* callback = new F(std::move(f)); return xbt_automaton_propositional_symbol_new_callback( a, id, [](void* callback) -> int { return (*(F*)callback)(); }, @@ -34,5 +32,4 @@ xbt_automaton_propositional_symbol_t add_proposition( } } - #endif