diff --git a/alib2common/src/abstraction/AlgorithmAbstraction.hpp b/alib2common/src/abstraction/AlgorithmAbstraction.hpp index bf1a0e55020885b92f581c443e2083a01a6b791e..12523647e98068b7a9747fb8beb9a311f8923f45 100644 --- a/alib2common/src/abstraction/AlgorithmAbstraction.hpp +++ b/alib2common/src/abstraction/AlgorithmAbstraction.hpp @@ -59,12 +59,12 @@ protected: return false; } }; - return std::call_on_nth < bool > ( inputs, index, attachCallback ); + return ext::call_on_nth < bool > ( inputs, index, attachCallback ); } virtual bool detachInput ( const std::shared_ptr < OperationAbstraction > & input ) override { bool res = false; - std::foreach ( inputs, [ & ] ( auto & param ) { + ext::foreach ( inputs, [ & ] ( auto & param ) { if ( param == input ) { param = nullptr; res = true; @@ -79,7 +79,7 @@ public: return ( bool ) param && param->isReady ( ); }; - return all_of ( inputs, readyCallback ); + return ext::all_of ( inputs, readyCallback ); } virtual bool inputsAttached ( ) const override { @@ -87,7 +87,7 @@ public: return ( bool ) param; }; - return all_of ( inputs, attachedCallback ); + return ext::all_of ( inputs, attachedCallback ); } virtual bool eval ( ) override { @@ -101,7 +101,7 @@ public: return param->eval ( ); }; - if ( ! all_of ( inputs, evalCallback ) ) + if ( ! ext::all_of ( inputs, evalCallback ) ) return false; return this->run ( ); @@ -116,7 +116,7 @@ public: std::string paramType = ext::to_string < typename std::decay < decltype ( param ) >::type::element_type::return_type > ( ); return Registry::getImmediateAbstraction ( std::move ( paramType ), value ); }; - return std::call_on_nth < std::shared_ptr < OperationAbstraction > > ( inputs, index, callback ); + return ext::call_on_nth < std::shared_ptr < OperationAbstraction > > ( inputs, index, callback ); } virtual std::shared_ptr < OperationAbstraction > getXmlParserFromParam ( unsigned index, std::deque < sax::Token > tokens ) const override { @@ -124,7 +124,7 @@ public: std::string paramType = ext::to_string < typename std::decay < decltype ( param ) >::type::element_type::return_type > ( ); return Registry::getXmlParserAbstraction ( std::move ( paramType ), std::move ( tokens ) ); }; - return std::call_on_nth < std::shared_ptr < OperationAbstraction > > ( inputs, index, callback ); + return ext::call_on_nth < std::shared_ptr < OperationAbstraction > > ( inputs, index, callback ); } }; diff --git a/alib2common/src/core/multipleDispatch.hpp b/alib2common/src/core/multipleDispatch.hpp index 9303860a6a866bb3a59459f322c31f0c2c209a56..09ea9a013afd56c8c19403c462af10b0c52d13fe 100644 --- a/alib2common/src/core/multipleDispatch.hpp +++ b/alib2common/src/core/multipleDispatch.hpp @@ -59,7 +59,7 @@ private: }; - std::map < typename std::TupleBuilder < std::type_index, sizeof ... ( DispatchedParameterTypes ) >::type, std::unique_ptr < RegistratorWrapperBase > > registeredFunctions; + std::map < typename ext::TupleBuilder < std::type_index, sizeof ... ( DispatchedParameterTypes ) >::type, std::unique_ptr < RegistratorWrapperBase > > registeredFunctions; static MultipleDispatch < Algorithm, ReturnType, std::tuple < FrontStaticParamTypes ... >, std::tuple < DispatchedParameterTypes ... >, std::tuple < BackStaticParamTypes ... > > & getInstance ( ) { static MultipleDispatch < Algorithm, ReturnType, std::tuple < FrontStaticParamTypes ... >, std::tuple < DispatchedParameterTypes ... >, std::tuple < BackStaticParamTypes ... > > res; diff --git a/alib2std/src/extensions/tree_base.hpp b/alib2std/src/extensions/tree_base.hpp index 69670c2c76565037974b98acf41718e90ef38321..e7644a7bceace51615c463985b62aeeb8d66d4d5 100644 --- a/alib2std/src/extensions/tree_base.hpp +++ b/alib2std/src/extensions/tree_base.hpp @@ -72,8 +72,8 @@ public: template < class Data, int arity, class ConstData = Data, class Cast = Data > class AnyaryNode { - typedef typename std::TupleBuilder < Data, arity >::type ChildrenType; - typedef typename std::TupleBuilder < ConstData, arity >::type ConstChildrenType; + typedef typename ext::TupleBuilder < Data, arity >::type ChildrenType; + typedef typename ext::TupleBuilder < ConstData, arity >::type ConstChildrenType; union ChildrenUnion { ChildrenType children; @@ -95,7 +95,7 @@ class AnyaryNode { } public: - AnyaryNode ( typename std::TupleBuilder < Data, arity >::type c ) : children_union ( std::move ( c ) ) { + AnyaryNode ( typename ext::TupleBuilder < Data, arity >::type c ) : children_union ( std::move ( c ) ) { setParent ( std::make_index_sequence < arity > ( ) ); } @@ -122,11 +122,11 @@ public: return * this; } - const typename std::TupleBuilder < Data, arity >::type & getElements ( ) { + const typename ext::TupleBuilder < Data, arity >::type & getElements ( ) { return children_union.children; } - const typename std::TupleBuilder < ConstData, arity >::type & getElements ( ) const { + const typename ext::TupleBuilder < ConstData, arity >::type & getElements ( ) const { return children_union.const_children; } @@ -140,7 +140,7 @@ public: return std::get < N > ( children_union.children ); } - void setElements ( typename std::TupleBuilder < Data, arity >::type c ) { + void setElements ( typename ext::TupleBuilder < Data, arity >::type c ) { children_union.children = std::move ( c ); setParent ( std::make_index_sequence < arity > ( ) ); } @@ -479,7 +479,7 @@ public: } template < int arity > - static void setChildren ( const AnyaryNode < Data, arity, ConstData, Cast > & node, typename std::TupleBuilder < Data, arity >::type children ) { + static void setChildren ( const AnyaryNode < Data, arity, ConstData, Cast > & node, typename ext::TupleBuilder < Data, arity >::type children ) { const_cast < AnyaryNode < Data, arity, ConstData, Cast > & > ( node ).setChildren ( std::move ( children ) ); } diff --git a/alib2std/src/extensions/tuple.hpp b/alib2std/src/extensions/tuple.hpp index b447a6078f7d3d35d43e9f177992080b5042cb6d..7b25712e9128c968cc03cf63e1347cfec5c60067 100644 --- a/alib2std/src/extensions/tuple.hpp +++ b/alib2std/src/extensions/tuple.hpp @@ -15,7 +15,7 @@ #include "compare.hpp" -namespace std { +namespace ext { template < class Result, unsigned I, class Tuple, class Callable > struct call_on_nth_helper; @@ -76,11 +76,13 @@ bool all_of ( const Tuple & t, Callable callback ) { res &= callback ( arg0 ); }; - std::foreach ( t, aggregateCallback ); + ext::foreach ( t, aggregateCallback ); return res; } +} /* namespace ext */ +namespace std { template<int I, class Tuple> struct operator_shift_left_impl; @@ -152,10 +154,6 @@ std::string to_string ( const std::tuple < Ts ... > & value ) { return ss.str(); } -} /* namespace ext */ - -namespace std { - template < class Type, int size, class ... Types > struct TupleBuilder; @@ -168,6 +166,6 @@ template < class Type, int n, class ... Types > struct TupleBuilder : public TupleBuilder < Type, n - 1, Type, Types ... > { }; -} /* namespace std */ +} /* namespace ext */ #endif /* __TUPLE_HPP_ */ diff --git a/alib2std/test-src/extensions/TupleTest.cpp b/alib2std/test-src/extensions/TupleTest.cpp index d3a15c23bf1416ba0f7500284ec36752102c4dc1..e0190466c73bb94463b7292d3a9558245ccefe54 100644 --- a/alib2std/test-src/extensions/TupleTest.cpp +++ b/alib2std/test-src/extensions/TupleTest.cpp @@ -13,6 +13,6 @@ void TupleTest::tearDown() { void TupleTest::testCallOnNth() { std::tuple < int, int, int, int, int > t = std::make_tuple ( 1, 2, 3, 4, 5 ); - CPPUNIT_ASSERT ( std::call_on_nth < int > ( t, 1, [] ( int i ) { return i; } ) == 2 ); + CPPUNIT_ASSERT ( ext::call_on_nth < int > ( t, 1, [] ( int i ) { return i; } ) == 2 ); }