@@ -282,8 +282,8 @@ bool AUTOQ::Automata<AUTOQ::Symbol::Index>::operator<=(const Automata<AUTOQ::Sym
282
282
return true ;
283
283
}
284
284
285
- template <>
286
- bool AUTOQ::Automata<AUTOQ:: Symbol::Concrete >::operator <=(const Automata<AUTOQ:: Symbol::Concrete > &autB) const {
285
+ template <typename Symbol >
286
+ bool AUTOQ::Automata<Symbol>::operator <=(const Automata<Symbol> &autB) const {
287
287
// migrate instance variables
288
288
Automata<AUTOQ::Symbol::Index> aut1;
289
289
aut1.name = this ->name ;
@@ -325,7 +325,13 @@ bool AUTOQ::Automata<AUTOQ::Symbol::Concrete>::operator<=(const Automata<AUTOQ::
325
325
if (i == symbol_map.size ()) {
326
326
symbol_map.push_back (symbol);
327
327
}
328
- if (i == symbol_map.size () || symbol_map.at (i).valueEqual (symbol)) {
328
+ bool eq;
329
+ if constexpr (std::is_same_v<Symbol, AUTOQ::Symbol::Concrete>) {
330
+ eq = symbol_map.at (i).valueEqual (symbol);
331
+ } else {
332
+ eq = symbol_map.at (i) == symbol;
333
+ }
334
+ if (i == symbol_map.size () || eq) {
329
335
Automata<AUTOQ::Symbol::Index>::SymbolTag symbol_tag2 = {AUTOQ::Symbol::Index (symbol.is_leaf (), i), symbol_tag.tag ()};
330
336
for (const auto &out_ins : t.second ) {
331
337
const auto &out = out_ins.first ;
@@ -345,7 +351,13 @@ bool AUTOQ::Automata<AUTOQ::Symbol::Concrete>::operator<=(const Automata<AUTOQ::
345
351
if (i == symbol_map.size ()) {
346
352
symbol_map.push_back (symbol);
347
353
}
348
- if (i == symbol_map.size () || symbol_map.at (i).valueEqual (symbol)) {
354
+ bool eq;
355
+ if constexpr (std::is_same_v<Symbol, AUTOQ::Symbol::Concrete>) {
356
+ eq = symbol_map.at (i).valueEqual (symbol);
357
+ } else {
358
+ eq = symbol_map.at (i) == symbol;
359
+ }
360
+ if (i == symbol_map.size () || eq) {
349
361
Automata<AUTOQ::Symbol::Index>::SymbolTag symbol_tag2 = {AUTOQ::Symbol::Index (symbol.is_leaf (), i), symbol_tag.tag ()};
350
362
for (const auto &out_ins : t.second ) {
351
363
const auto &out = out_ins.first ;
@@ -378,11 +390,6 @@ bool AUTOQ::Automata<AUTOQ::Symbol::Concrete>::operator<=(const Automata<AUTOQ::
378
390
return result;
379
391
}
380
392
381
- template <typename Symbol>
382
- bool AUTOQ::Automata<Symbol>::operator <=(const Automata<Symbol> &) const {
383
- THROW_AUTOQ_ERROR (" The operator <= is not defined for the given type of automata." );
384
- }
385
-
386
393
bool AUTOQ::check_validity (Constraint C, const PredicateAutomata::Symbol &ps, const SymbolicAutomata::Symbol &te) {
387
394
std::string str (ps);
388
395
/* Replace all real(.) in C.content with .R and
@@ -742,6 +749,7 @@ bool operator<=(const AUTOQ::SymbolicAutomata &autA, const AUTOQ::PredicateAutom
742
749
// https://bytefreaks.net/programming-2/c/c-undefined-reference-to-templated-class-function
743
750
template struct AUTOQ ::Automata<AUTOQ::Symbol::Concrete>;
744
751
template struct AUTOQ ::Automata<AUTOQ::Symbol::Symbolic>;
752
+ template struct AUTOQ ::Automata<AUTOQ::Symbol::Predicate>;
745
753
746
754
// #define MIN
747
755
0 commit comments