Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <type_traits>
- #include <algorithm>
- // if they are on two different types, function returs false.
- template< typename T, typename U, typename F, typename G >
- typename std::enable_if< !std::is_same<T,U>::value, bool >::type
- check( const my_vector<T,F>& , const my_vector<U,G>& ) { return false ; }
- // same type and on the same functor ...
- template< typename T, typename U, typename F, typename G >
- typename std::enable_if< std::is_same<T,U>::value && std::is_same<F,G>::value, bool >::type
- check( const my_vector<T,F>& a, const my_vector<U,G>& b )
- {
- if( a.size() == b.size() ) return std::equal( a.begin(), a.end(), b.begin() ) ;
- else return false ;
- }
- // on same type but different functors, create a new my_vector ...
- template< typename T, typename U, typename F, typename G >
- typename std::enable_if< std::is_same<T,U>::value && !std::is_same<F,G>::value, bool >::type
- check( const my_vector<T,F>& a, const my_vector<U,G>& b )
- { return a.size() == b.size() ? check( a, my_vector<T,F>(b) ) : false ; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement