Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Typed template for Extendable::get_data.
[simgrid.git] / include / xbt / automaton.hpp
index c836942..aea5fc6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2019. The SimGrid Team.
+/* Copyright (c) 2015-2022. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -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<class F>
-xbt_automaton_propositional_symbol_t add_proposition(
-  xbt_automaton_t a, const char* id, F f)
+template <class F> 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)(); },