diff --git a/alib2data/src/automaton/FSM/NFA.h b/alib2data/src/automaton/FSM/NFA.h index cbf2077c1c60ebd44fc999dec52124c1905a56ec..71aa2a44d0858b76755a3452a80ebec8baa04223 100644 --- a/alib2data/src/automaton/FSM/NFA.h +++ b/alib2data/src/automaton/FSM/NFA.h @@ -193,6 +193,8 @@ public: virtual alib::ObjectBase * inc ( ) &&; + typedef NFA < > normalized_type; + virtual AutomatonBase * normalize ( ) && { if ( typeid ( NFA < > ) == typeid ( NFA < SymbolType, StateType > ) ) return this; diff --git a/alib2std/src/extensions/type_traits.hpp b/alib2std/src/extensions/type_traits.hpp index 459bb5acfbb5039c1ed9622cef71cc7807b7a9a4..05e27fdb6ba16ab9fd12198ad705c0fc920e5019 100644 --- a/alib2std/src/extensions/type_traits.hpp +++ b/alib2std/src/extensions/type_traits.hpp @@ -23,6 +23,17 @@ namespace std { static const bool value = sizeof(Yes) == sizeof(has_clone::test((typename std::remove_reference<T>::type*)0)); }; + template<class T> + struct has_normalize { + typedef char (&Yes)[1]; + typedef char (&No)[2]; + + template<class U> + static Yes test(U * data, typename std::enable_if< std::is_pointer<decltype(data->normalize())>::value>::type * = 0); + static No test(...); + static const bool value = sizeof(Yes) == sizeof(has_normalize::test((typename std::remove_reference<T>::type*)0)); + }; + // ---------------------------------------------------------------------------------------------------- template <typename T>