diff --git a/src/ltlast/formula.hh b/src/ltlast/formula.hh index 359bfbf2a..943f7ac3b 100644 --- a/src/ltlast/formula.hh +++ b/src/ltlast/formula.hh @@ -501,31 +501,6 @@ namespace spot } }; - /// \ingroup ltl_essentials - /// \ingroup hash_funcs - /// \brief Hash Function for const formula*. - /// - /// This is meant to be used as a hash functor for - /// \c unordered_map whose key are of type const formula*. - /// - /// For instance here is how one could declare - /// a map of \c const::formula*. - /// \code - /// // Remember how many times each formula has been seen. - /// std::unordered_map seen; - /// \endcode - struct formula_ptr_hash: - public std::unary_function - { - size_t - operator()(const formula* that) const - { - assert(that); - return that->hash(); - } - }; - /// Print the properties of formula \a f on stream \a out. SPOT_API std::ostream& print_formula_props(std::ostream& out, @@ -538,4 +513,19 @@ namespace spot } } +#ifndef SWIG +namespace std +{ + template <> + struct hash + { + size_t operator()(const spot::ltl::formula* x) const noexcept + { + assert(x); + return x->hash(); + } + }; +} +#endif + #endif // SPOT_LTLAST_FORMULA_HH diff --git a/src/ltlvisit/contain.hh b/src/ltlvisit/contain.hh index 579390525..ddcc0d992 100644 --- a/src/ltlvisit/contain.hh +++ b/src/ltlvisit/contain.hh @@ -41,8 +41,7 @@ namespace spot typedef std::map incomp_map; incomp_map incompatible; }; - typedef std::unordered_map trans_map; + typedef std::unordered_map trans_map; public: /// This class uses spot::ltl_to_tgba_fm to translate LTL /// formulae. See that function for the meaning of these options. diff --git a/src/ltlvisit/relabel.cc b/src/ltlvisit/relabel.cc index 5f7927cb8..73ca7f624 100644 --- a/src/ltlvisit/relabel.cc +++ b/src/ltlvisit/relabel.cc @@ -92,8 +92,7 @@ namespace spot class relabeler: public clone_visitor { public: - typedef std::unordered_map > map; + typedef std::unordered_map map; map newname; ap_generator* gen; relabeling_map* oldnames; @@ -358,8 +357,7 @@ namespace spot { } }; - typedef std::unordered_map fmap_t; + typedef std::unordered_map fmap_t; struct stack_entry { const formula* grand_parent; diff --git a/src/tgba/taatgba.hh b/src/tgba/taatgba.hh index e9b376ebb..f61ad0b50 100644 --- a/src/tgba/taatgba.hh +++ b/src/tgba/taatgba.hh @@ -23,6 +23,7 @@ #include #include #include +#include #include "misc/hash.hh" #include "ltlast/formula.hh" #include "bdddict.hh" @@ -144,7 +145,7 @@ namespace spot /// A taa_tgba instance with states labeled by a given type. /// Still an abstract class, see below. - template + template class SPOT_API taa_tgba_labelled : public taa_tgba { public: @@ -236,8 +237,7 @@ namespace spot protected: typedef label label_t; - typedef std::unordered_map ns_map; + typedef std::unordered_map ns_map; typedef std::unordered_map > sn_map; @@ -308,14 +308,14 @@ namespace spot class SPOT_API taa_tgba_string : #ifndef SWIG - public taa_tgba_labelled + public taa_tgba_labelled #else public taa_tgba #endif { public: taa_tgba_string(const bdd_dict_ptr& dict) : - taa_tgba_labelled(dict) {}; + taa_tgba_labelled(dict) {}; ~taa_tgba_string(); protected: virtual std::string label_to_string(const std::string& label) const; @@ -332,14 +332,14 @@ namespace spot class SPOT_API taa_tgba_formula : #ifndef SWIG - public taa_tgba_labelled + public taa_tgba_labelled #else public taa_tgba #endif { public: taa_tgba_formula(const bdd_dict_ptr& dict) : - taa_tgba_labelled(dict) {}; + taa_tgba_labelled(dict) {}; ~taa_tgba_formula(); protected: virtual std::string label_to_string(const label_t& label) const; diff --git a/src/tgbaalgos/ltl2tgba_fm.cc b/src/tgbaalgos/ltl2tgba_fm.cc index 228e58815..cb3497dd2 100644 --- a/src/tgbaalgos/ltl2tgba_fm.cc +++ b/src/tgbaalgos/ltl2tgba_fm.cc @@ -110,8 +110,7 @@ namespace spot class ratexp_to_dfa { - typedef typename tgba_digraph::namer::type namer; + typedef typename tgba_digraph::namer::type namer; public: ratexp_to_dfa(translate_dict& dict); std::tuple @@ -124,8 +123,7 @@ namespace spot private: translate_dict& dict_; - typedef std::unordered_map f2a_t; + typedef std::unordered_map f2a_t; std::vector automata_; f2a_t f2a_; }; @@ -1068,7 +1066,7 @@ namespace spot assert(f->is_in_nenoform()); auto a = make_tgba_digraph(dict_.dict); - auto namer = a->create_namer(); + auto namer = a->create_namer(); typedef std::set set_type; set_type formulae_to_translate; @@ -1931,8 +1929,7 @@ namespace spot } private: - typedef std::unordered_map pfl_map; + typedef std::unordered_map pfl_map; pfl_map pfl_; }; @@ -2084,8 +2081,8 @@ namespace spot // Map each formula to its associated bdd. This speed things up when // the same formula is translated several times, which especially // occurs when canonize() is called repeatedly inside exprop. - typedef std::unordered_map > formula_to_bdd_map; + typedef std::unordered_map formula_to_bdd_map; formula_to_bdd_map f2b_; possible_fair_loop_checker pflc_; @@ -2097,8 +2094,7 @@ namespace spot } typedef std::map prom_map; - typedef std::unordered_map dest_map; + typedef std::unordered_map dest_map; static void fill_dests(translate_dict& d, dest_map& dests, bdd label, const formula* dest) @@ -2151,7 +2147,7 @@ namespace spot assert(dict == s->get_dict()); tgba_digraph_ptr a = make_tgba_digraph(dict); - auto namer = a->create_namer(); + auto namer = a->create_namer(); translate_dict d(dict, a->acc(), s, exprop, f->is_syntactic_persistence());