Skip to content
Snippets Groups Projects
Commit c90b5828 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix base inaccessible and optimize

parent 92cab935
No related branches found
No related tags found
No related merge requests found
...@@ -390,18 +390,19 @@ class Components; ...@@ -390,18 +390,19 @@ class Components;
/** /**
* Auxiliary class allowing simple access to the alphabets. * Auxiliary class allowing simple access to the alphabets.
*/ */
template < class Derived, class DataType, class SetTypesPack, class ElementTypesPack > template < class Derived >
class Components < Derived, DataType, SetTypesPack, ElementTypesPack > : public ComponentAux < Derived, DataType, SetTypesPack >, public ElementAux < Derived, DataType, ElementTypesPack > { class Components < Derived > {
public: public:
/** /**
* Construct an alphabet pack from two alphabets. * Construct an alphabet pack from two alphabets.
*/ */
template < class RealSetTypes, class RealElementTypes > Components ( ) {
Components ( RealSetTypes params1, RealElementTypes params2 ) : ComponentAux < Derived, DataType, SetTypesPack > ( std::move ( params1 ), std::make_index_sequence < std::tuple_size < SetTypesPack >::value > { } ), ElementAux < Derived, DataType, ElementTypesPack > ( std::move ( params2 ), std::make_index_sequence < std::tuple_size < ElementTypesPack >::value > { } ) {
ComponentAux < Derived, DataType, SetTypesPack >::checkState ( );
ElementAux < Derived, DataType, ElementTypesPack >::checkState ( );
} }
template < class T, typename std::enable_if < ! std::is_same < T, T >::value >::type * = nullptr >
void accessComponent ( );
template < class T, typename std::enable_if < ! std::is_same < T, T >::value >::type * = nullptr >
void accessElement ( );
}; };
   
/** /**
...@@ -427,6 +428,63 @@ public: ...@@ -427,6 +428,63 @@ public:
using Components < Derived, NextGroup ... >::accessElement; using Components < Derived, NextGroup ... >::accessElement;
}; };
   
/**
* Auxiliary class allowing simple access to the alphabets.
*/
template < class Derived, class DataType, class ElementTypesPack, class ... NextGroup >
class Components < Derived, DataType, std::tuple < >, ElementTypesPack, NextGroup ... > : public ElementAux < Derived, DataType, ElementTypesPack >, public Components < Derived, NextGroup ... > {
public:
/**
* Construct an alphabet pack from two alphabets.
*/
template < class RealElementTypes, class ... NextRealTypes >
Components ( const std::tuple < > & , RealElementTypes params2, NextRealTypes ... nextParams ) : ElementAux < Derived, DataType, ElementTypesPack > ( std::move ( params2 ), std::make_index_sequence < std::tuple_size < ElementTypesPack >::value > { } ), Components < Derived, NextGroup ... > ( std::move ( nextParams ) ... ) {
ElementAux < Derived, DataType, ElementTypesPack >::checkState ( );
}
using ElementAux < Derived, DataType, ElementTypesPack >::accessElement;
using Components < Derived, NextGroup ... >::accessComponent;
using Components < Derived, NextGroup ... >::accessElement;
};
/**
* Auxiliary class allowing simple access to the alphabets.
*/
template < class Derived, class DataType, class SetTypesPack, class ... NextGroup >
class Components < Derived, DataType, SetTypesPack, std::tuple < >, NextGroup ... > : public ComponentAux < Derived, DataType, SetTypesPack >, public Components < Derived, NextGroup ... > {
public:
/**
* Construct an alphabet pack from two alphabets.
*/
template < class RealSetTypes, class ... NextRealTypes >
Components ( RealSetTypes params1, const std::tuple < > & , NextRealTypes ... nextParams ) : ComponentAux < Derived, DataType, SetTypesPack > ( std::move ( params1 ), std::make_index_sequence < std::tuple_size < SetTypesPack >::value > { } ), Components < Derived, NextGroup ... > ( std::move ( nextParams ) ... ) {
ComponentAux < Derived, DataType, SetTypesPack >::checkState ( );
}
using ComponentAux < Derived, DataType, SetTypesPack >::accessComponent;
using Components < Derived, NextGroup ... >::accessComponent;
using Components < Derived, NextGroup ... >::accessElement;
};
/**
* Auxiliary class allowing simple access to the alphabets.
*/
template < class Derived, class DataType, class ... NextGroup >
class Components < Derived, DataType, std::tuple < >, std::tuple < >, NextGroup ... > : public Components < Derived, NextGroup ... > {
public:
/**
* Construct an alphabet pack from two alphabets.
*/
template < class ... NextRealTypes >
Components ( const std::tuple < > & , const std::tuple < > & , NextRealTypes ... nextParams ) : Components < Derived, NextGroup ... > ( std::move ( nextParams ) ... ) {
}
using Components < Derived, NextGroup ... >::accessComponent;
using Components < Derived, NextGroup ... >::accessElement;
};
} /* namespace std */ } /* namespace std */
   
#endif /* COMPONENTS2_HPP_ */ #endif /* COMPONENTS2_HPP_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment