VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Namespaces | Macros | Functions
templateUtil.h File Reference

Go to the source code of this file.

Classes

struct  makVrv::SortByFirst< Key, Value >
 
struct  makVrv::SortPointersByFunction_T< Ret, T >
 
struct  makVrv::EqualPointerByFunction_T< Ret, T >
 

Namespaces

 makVrv
 

Macros

#define DO_PP(MACRO)   MACRO
 
#define MAKE_STREAM_1(word)   word##1
 
#define MAKE_STREAM_2(word)   MAKE_STREAM_1(word)<<word##2
 
#define MAKE_STREAM_3(word)   MAKE_STREAM_2(word)<<word##3
 
#define MAKE_STREAM_4(word)   MAKE_STREAM_3(word)<<word##4
 
#define MAKE_STREAM_5(word)   MAKE_STREAM_4(word)<<word##5
 
#define MAKE_STREAM_6(word)   MAKE_STREAM_5(word)<<word##6
 
#define MAKE_STREAM_7(word)   MAKE_STREAM_6(word)<<word##7
 
#define MAKE_STREAM_8(word)   MAKE_STREAM_7(word)<<word##8
 
#define MAKE_STREAM_9(word)   MAKE_STREAM_8(word)<<word##9
 
#define MAKE_STREAM_10(word)   MAKE_STREAM_9(word)<<word##10
 
#define MAKE_STREAM(word, count)   DO_PP(MAKE_STREAM_##count(word))
 
#define MAKE_STREAMOUT_1(word)   word##1
 
#define MAKE_STREAMOUT_2(word)   MAKE_STREAMOUT_1(word)>>word##2
 
#define MAKE_STREAMOUT_3(word)   MAKE_STREAMOUT_2(word)>>word##3
 
#define MAKE_STREAMOUT_4(word)   MAKE_STREAMOUT_3(word)>>word##4
 
#define MAKE_STREAMOUT_5(word)   MAKE_STREAMOUT_4(word)>>word##5
 
#define MAKE_STREAMOUT_6(word)   MAKE_STREAMOUT_5(word)>>word##6
 
#define MAKE_STREAMOUT_7(word)   MAKE_STREAMOUT_6(word)>>word##7
 
#define MAKE_STREAMOUT_8(word)   MAKE_STREAMOUT_7(word)>>word##8
 
#define MAKE_STREAMOUT_9(word)   MAKE_STREAMOUT_8(word)>>word##9
 
#define MAKE_STREAMOUT_10(word)   MAKE_STREAMOUT_9(word)>>word##10
 
#define MAKE_STREAMOUT(word, count)   DO_PP(MAKE_STREAMOUT_##count(word))
 
#define MAKE_LIST_1(word)   word##1
 
#define MAKE_LIST_2(word)   MAKE_LIST_1(word),word##2
 
#define MAKE_LIST_3(word)   MAKE_LIST_2(word),word##3
 
#define MAKE_LIST_4(word)   MAKE_LIST_3(word),word##4
 
#define MAKE_LIST_5(word)   MAKE_LIST_4(word),word##5
 
#define MAKE_LIST_6(word)   MAKE_LIST_5(word),word##6
 
#define MAKE_LIST_7(word)   MAKE_LIST_6(word),word##7
 
#define MAKE_LIST_8(word)   MAKE_LIST_7(word),word##8
 
#define MAKE_LIST_9(word)   MAKE_LIST_8(word),word##9
 
#define MAKE_LIST_10(word)   MAKE_LIST_9(word),word##10
 
#define MAKE_LIST(word, count)   DO_PP(MAKE_LIST_##count(word))
 
#define MAKE_MULTILIST_1(first, second)   first##1 second##1
 
#define MAKE_MULTILIST_2(first, second)   MAKE_MULTILIST_1(first,second),first##2 second##2
 
#define MAKE_MULTILIST_3(first, second)   MAKE_MULTILIST_2(first,second),first##3 second##3
 
#define MAKE_MULTILIST_4(first, second)   MAKE_MULTILIST_3(first,second),first##4 second##4
 
#define MAKE_MULTILIST_5(first, second)   MAKE_MULTILIST_4(first,second),first##5 second##5
 
#define MAKE_MULTILIST_6(first, second)   MAKE_MULTILIST_5(first,second),first##6 second##6
 
#define MAKE_MULTILIST_7(first, second)   MAKE_MULTILIST_6(first,second),first##7 second##7
 
#define MAKE_MULTILIST_8(first, second)   MAKE_MULTILIST_7(first,second),first##8 second##8
 
#define MAKE_MULTILIST_9(first, second)   MAKE_MULTILIST_8(first,second),first##9 second##9
 
#define MAKE_MULTILIST_10(first, second)   MAKE_MULTILIST_9(first,second),first##10 second##10
 
#define MAKE_MULTILIST(first, second, count)   DO_PP(MAKE_MULTILIST_##count(first,second))
 
#define MAKE_CAST_CALL_1(first, second, third, forth)   first##1 second(third,forth##1)
 
#define MAKE_CAST_CALL_2(first, second, third, forth)   MAKE_CAST_CALL_1(first,second,third,forth),first##2 second(third,forth##2)
 
#define MAKE_CAST_CALL_3(first, second, third, forth)   MAKE_CAST_CALL_2(first,second,third,forth),first##3 second(third,forth##3)
 
#define MAKE_CAST_CALL_4(first, second, third, forth)   MAKE_CAST_CALL_3(first,second,third,forth),first##4 second(third,forth##4)
 
#define MAKE_CAST_CALL_5(first, second, third, forth)   MAKE_CAST_CALL_4(first,second,third,forth),first##5 second(third,forth##5)
 
#define MAKE_CAST_CALL_6(first, second, third, forth)   MAKE_CAST_CALL_5(first,second,third,forth),first##6 second(third,forth##6)
 
#define MAKE_CAST_CALL_7(first, second, third, forth)   MAKE_CAST_CALL_6(first,second,third,forth),first##7 second(third,forth##7)
 
#define MAKE_CAST_CALL_8(first, second, third, forth)   MAKE_CAST_CALL_7(first,second,third,forth),first##8 second(third,forth##8)
 
#define MAKE_CAST_CALL_9(first, second, third, forth)   MAKE_CAST_CALL_8(first,second,third,forth),first##9 second(third,forth##9)
 
#define MAKE_CAST_CALL_10(first, second, third, forth)   MAKE_CAST_CALL_9(first,second,third,forth),first##10 second(third,forth##10)
 
#define MAKE_CAST_CALL(first, second, third, forth, count)   DO_PP(MAKE_CAST_CALL_##count(first,second,third,forth))
 
#define MAKE_DECL_LIST_1(word)   word##1
 
#define MAKE_DECL_LIST_2(word)   MAKE_DECL_LIST_1(word);word##2
 
#define MAKE_DECL_LIST_3(word)   MAKE_DECL_LIST_2(word);word##3
 
#define MAKE_DECL_LIST_4(word)   MAKE_DECL_LIST_3(word);word##4
 
#define MAKE_DECL_LIST_5(word)   MAKE_DECL_LIST_4(word);word##5
 
#define MAKE_DECL_LIST_6(word)   MAKE_DECL_LIST_5(word);word##6
 
#define MAKE_DECL_LIST_7(word)   MAKE_DECL_LIST_6(word);word##7
 
#define MAKE_DECL_LIST_8(word)   MAKE_DECL_LIST_7(word);word##8
 
#define MAKE_DECL_LIST_9(word)   MAKE_DECL_LIST_8(word);word##9
 
#define MAKE_DECL_LIST_10(word)   MAKE_DECL_LIST_9(word);word##10
 
#define MAKE_DECL_LIST(word, count)   DO_PP(MAKE_DECL_LIST_##count(word))
 
#define MAKE_DECL_MULTILIST_1(first, second)   first##1 second##1
 
#define MAKE_DECL_MULTILIST_2(first, second)   MAKE_DECL_MULTILIST_1(first,second);first##2 second##2
 
#define MAKE_DECL_MULTILIST_3(first, second)   MAKE_DECL_MULTILIST_2(first,second);first##3 second##3
 
#define MAKE_DECL_MULTILIST_4(first, second)   MAKE_DECL_MULTILIST_3(first,second);first##4 second##4
 
#define MAKE_DECL_MULTILIST_5(first, second)   MAKE_DECL_MULTILIST_4(first,second);first##5 second##5
 
#define MAKE_DECL_MULTILIST_6(first, second)   MAKE_DECL_MULTILIST_5(first,second);first##6 second##6
 
#define MAKE_DECL_MULTILIST_7(first, second)   MAKE_DECL_MULTILIST_6(first,second);first##7 second##7
 
#define MAKE_DECL_MULTILIST_8(first, second)   MAKE_DECL_MULTILIST_7(first,second);first##8 second##8
 
#define MAKE_DECL_MULTILIST_9(first, second)   MAKE_DECL_MULTILIST_8(first,second);first##9 second##9
 
#define MAKE_DECL_MULTILIST_10(first, second)   MAKE_DECL_MULTILIST_9(first,second);first##10 second##10
 
#define MAKE_DECL_MULTILIST(first, second, count)   DO_PP(MAKE_DECL_MULTILIST_##count(first,second))
 
#define EXPORT_TEMPLATE_TYPEDEF(C, TD)
 
#define FAST_REPEATED_CALL(count, x)
 

Functions

template<typename K , typename V , typename Pr , typename Alloc >
V * makVrv::DtFindPointerInMap (const std::map< K, V, Pr, Alloc > &map, K key)
 
template<typename M >
void makVrv::DtClearAndDeletePointersInMap (M &map)
 
template<typename V >
void makVrv::DtClearAndDeletePointersInVector (V &vec)
 
template<typename Iter >
void makVrv::DtDeletePointersInIterators (Iter begin, Iter end)
 
template<typename T , typename R , typename A , typename Col >
void makVrv::forEachCallMember (T *_this, R(T::*memfun)(A), Col &col)
 
template<typename Ret , typename AT , typename Class >
Ret makVrv::callConstFunction1 (const Class *_this, const Ret(Class::*memberPtr)(AT) const, AT param)
 
template<typename T , void(T::*)() MF>
void makVrv::DtMemberFunctionCallback (DtDe *de, void *data)
 
template<class InputIterator1 , class InputIterator2 , class OutputIterator1 , class OutputIterator2 >
void makVrv::set_split_difference (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator1 result1, OutputIterator2 result2)
 
template<typename iter , typename T >
iter makVrv::fasterFind (size_t size, iter begin, iter end, const T &value)
 
template<typename iter , typename F >
iter makVrv::fastFindPred (size_t size, iter begin, iter end, const F &pred)
 
template<typename T , typename Ax >
void makVrv::fastEraseFromUnsortedVector (std::vector< T, Ax > &list, const T &value)
 
template<typename T , typename Ax >
void makVrv::fastEraseFromUnsortedVector (std::vector< T *, Ax > &list, const T *value)
 
template<typename T , typename Ax , typename Function >
void makVrv::fastEraseFromUnsortedVectorPred (std::vector< T, Ax > &list, const Function &f)
 
template<typename T , typename Ax , typename Function >
void makVrv::fastEraseFromUnsortedVectorPred (std::vector< T *, Ax > &list, const Function &f)
 
template<typename Ret , typename T >
SortPointersByFunction_T< Ret, T > makVrv::SortPointersByFunction (Ret(T::*ptr)() const)
 
template<typename Ret , typename T >
EqualPointerByFunction_T< Ret, T > makVrv::EqualPointerByFunction (Ret(T::*ptr)() const, Ret value)
 
template<typename K , typename V >
const V & makVrv::findOrThrow (const std::map< K, V, std::less< K >, std::allocator< std::pair< const K, V > > > &map, K key)
 
template<typename K , typename V >
const V & makVrv::findByIndexOrThrow (const std::map< K, V, std::less< K >, std::allocator< std::pair< const K, V > > > &map, int index)
 
template<typename V >
const V & makVrv::findByIndexOrThrow (const std::vector< V > &vec, int index)
 

Detailed Description

Contains utility macros and methods for templates.

Macro Definition Documentation

#define DO_PP (   MACRO)    MACRO
#define MAKE_STREAM_1 (   word)    word##1
#define MAKE_STREAM_2 (   word)    MAKE_STREAM_1(word)<<word##2
#define MAKE_STREAM_3 (   word)    MAKE_STREAM_2(word)<<word##3
#define MAKE_STREAM_4 (   word)    MAKE_STREAM_3(word)<<word##4
#define MAKE_STREAM_5 (   word)    MAKE_STREAM_4(word)<<word##5
#define MAKE_STREAM_6 (   word)    MAKE_STREAM_5(word)<<word##6
#define MAKE_STREAM_7 (   word)    MAKE_STREAM_6(word)<<word##7
#define MAKE_STREAM_8 (   word)    MAKE_STREAM_7(word)<<word##8
#define MAKE_STREAM_9 (   word)    MAKE_STREAM_8(word)<<word##9
#define MAKE_STREAM_10 (   word)    MAKE_STREAM_9(word)<<word##10
#define MAKE_STREAM (   word,
  count 
)    DO_PP(MAKE_STREAM_##count(word))
#define MAKE_STREAMOUT_1 (   word)    word##1
#define MAKE_STREAMOUT_2 (   word)    MAKE_STREAMOUT_1(word)>>word##2
#define MAKE_STREAMOUT_3 (   word)    MAKE_STREAMOUT_2(word)>>word##3
#define MAKE_STREAMOUT_4 (   word)    MAKE_STREAMOUT_3(word)>>word##4
#define MAKE_STREAMOUT_5 (   word)    MAKE_STREAMOUT_4(word)>>word##5
#define MAKE_STREAMOUT_6 (   word)    MAKE_STREAMOUT_5(word)>>word##6
#define MAKE_STREAMOUT_7 (   word)    MAKE_STREAMOUT_6(word)>>word##7
#define MAKE_STREAMOUT_8 (   word)    MAKE_STREAMOUT_7(word)>>word##8
#define MAKE_STREAMOUT_9 (   word)    MAKE_STREAMOUT_8(word)>>word##9
#define MAKE_STREAMOUT_10 (   word)    MAKE_STREAMOUT_9(word)>>word##10
#define MAKE_STREAMOUT (   word,
  count 
)    DO_PP(MAKE_STREAMOUT_##count(word))
#define MAKE_LIST_1 (   word)    word##1
#define MAKE_LIST_2 (   word)    MAKE_LIST_1(word),word##2
#define MAKE_LIST_3 (   word)    MAKE_LIST_2(word),word##3
#define MAKE_LIST_4 (   word)    MAKE_LIST_3(word),word##4
#define MAKE_LIST_5 (   word)    MAKE_LIST_4(word),word##5
#define MAKE_LIST_6 (   word)    MAKE_LIST_5(word),word##6
#define MAKE_LIST_7 (   word)    MAKE_LIST_6(word),word##7
#define MAKE_LIST_8 (   word)    MAKE_LIST_7(word),word##8
#define MAKE_LIST_9 (   word)    MAKE_LIST_8(word),word##9
#define MAKE_LIST_10 (   word)    MAKE_LIST_9(word),word##10
#define MAKE_LIST (   word,
  count 
)    DO_PP(MAKE_LIST_##count(word))
#define MAKE_MULTILIST_1 (   first,
  second 
)    first##1 second##1
#define MAKE_MULTILIST_2 (   first,
  second 
)    MAKE_MULTILIST_1(first,second),first##2 second##2
#define MAKE_MULTILIST_3 (   first,
  second 
)    MAKE_MULTILIST_2(first,second),first##3 second##3
#define MAKE_MULTILIST_4 (   first,
  second 
)    MAKE_MULTILIST_3(first,second),first##4 second##4
#define MAKE_MULTILIST_5 (   first,
  second 
)    MAKE_MULTILIST_4(first,second),first##5 second##5
#define MAKE_MULTILIST_6 (   first,
  second 
)    MAKE_MULTILIST_5(first,second),first##6 second##6
#define MAKE_MULTILIST_7 (   first,
  second 
)    MAKE_MULTILIST_6(first,second),first##7 second##7
#define MAKE_MULTILIST_8 (   first,
  second 
)    MAKE_MULTILIST_7(first,second),first##8 second##8
#define MAKE_MULTILIST_9 (   first,
  second 
)    MAKE_MULTILIST_8(first,second),first##9 second##9
#define MAKE_MULTILIST_10 (   first,
  second 
)    MAKE_MULTILIST_9(first,second),first##10 second##10
#define MAKE_MULTILIST (   first,
  second,
  count 
)    DO_PP(MAKE_MULTILIST_##count(first,second))
#define MAKE_CAST_CALL_1 (   first,
  second,
  third,
  forth 
)    first##1 second(third,forth##1)
#define MAKE_CAST_CALL_2 (   first,
  second,
  third,
  forth 
)    MAKE_CAST_CALL_1(first,second,third,forth),first##2 second(third,forth##2)
#define MAKE_CAST_CALL_3 (   first,
  second,
  third,
  forth 
)    MAKE_CAST_CALL_2(first,second,third,forth),first##3 second(third,forth##3)
#define MAKE_CAST_CALL_4 (   first,
  second,
  third,
  forth 
)    MAKE_CAST_CALL_3(first,second,third,forth),first##4 second(third,forth##4)
#define MAKE_CAST_CALL_5 (   first,
  second,
  third,
  forth 
)    MAKE_CAST_CALL_4(first,second,third,forth),first##5 second(third,forth##5)
#define MAKE_CAST_CALL_6 (   first,
  second,
  third,
  forth 
)    MAKE_CAST_CALL_5(first,second,third,forth),first##6 second(third,forth##6)
#define MAKE_CAST_CALL_7 (   first,
  second,
  third,
  forth 
)    MAKE_CAST_CALL_6(first,second,third,forth),first##7 second(third,forth##7)
#define MAKE_CAST_CALL_8 (   first,
  second,
  third,
  forth 
)    MAKE_CAST_CALL_7(first,second,third,forth),first##8 second(third,forth##8)
#define MAKE_CAST_CALL_9 (   first,
  second,
  third,
  forth 
)    MAKE_CAST_CALL_8(first,second,third,forth),first##9 second(third,forth##9)
#define MAKE_CAST_CALL_10 (   first,
  second,
  third,
  forth 
)    MAKE_CAST_CALL_9(first,second,third,forth),first##10 second(third,forth##10)
#define MAKE_CAST_CALL (   first,
  second,
  third,
  forth,
  count 
)    DO_PP(MAKE_CAST_CALL_##count(first,second,third,forth))
#define MAKE_DECL_LIST_1 (   word)    word##1
#define MAKE_DECL_LIST_2 (   word)    MAKE_DECL_LIST_1(word);word##2
#define MAKE_DECL_LIST_3 (   word)    MAKE_DECL_LIST_2(word);word##3
#define MAKE_DECL_LIST_4 (   word)    MAKE_DECL_LIST_3(word);word##4
#define MAKE_DECL_LIST_5 (   word)    MAKE_DECL_LIST_4(word);word##5
#define MAKE_DECL_LIST_6 (   word)    MAKE_DECL_LIST_5(word);word##6
#define MAKE_DECL_LIST_7 (   word)    MAKE_DECL_LIST_6(word);word##7
#define MAKE_DECL_LIST_8 (   word)    MAKE_DECL_LIST_7(word);word##8
#define MAKE_DECL_LIST_9 (   word)    MAKE_DECL_LIST_8(word);word##9
#define MAKE_DECL_LIST_10 (   word)    MAKE_DECL_LIST_9(word);word##10
#define MAKE_DECL_LIST (   word,
  count 
)    DO_PP(MAKE_DECL_LIST_##count(word))
#define MAKE_DECL_MULTILIST_1 (   first,
  second 
)    first##1 second##1
#define MAKE_DECL_MULTILIST_2 (   first,
  second 
)    MAKE_DECL_MULTILIST_1(first,second);first##2 second##2
#define MAKE_DECL_MULTILIST_3 (   first,
  second 
)    MAKE_DECL_MULTILIST_2(first,second);first##3 second##3
#define MAKE_DECL_MULTILIST_4 (   first,
  second 
)    MAKE_DECL_MULTILIST_3(first,second);first##4 second##4
#define MAKE_DECL_MULTILIST_5 (   first,
  second 
)    MAKE_DECL_MULTILIST_4(first,second);first##5 second##5
#define MAKE_DECL_MULTILIST_6 (   first,
  second 
)    MAKE_DECL_MULTILIST_5(first,second);first##6 second##6
#define MAKE_DECL_MULTILIST_7 (   first,
  second 
)    MAKE_DECL_MULTILIST_6(first,second);first##7 second##7
#define MAKE_DECL_MULTILIST_8 (   first,
  second 
)    MAKE_DECL_MULTILIST_7(first,second);first##8 second##8
#define MAKE_DECL_MULTILIST_9 (   first,
  second 
)    MAKE_DECL_MULTILIST_8(first,second);first##9 second##9
#define MAKE_DECL_MULTILIST_10 (   first,
  second 
)    MAKE_DECL_MULTILIST_9(first,second);first##10 second##10
#define MAKE_DECL_MULTILIST (   first,
  second,
  count 
)    DO_PP(MAKE_DECL_MULTILIST_##count(first,second))
#define EXPORT_TEMPLATE_TYPEDEF (   C,
  TD 
)
Value:
typedef C TD;\
template class C;
#define FAST_REPEATED_CALL (   count,
 
)
Value:
{ \
if(count > 0) \
{ \
size_t __FAST_ITERATE_count = count;\
size_t __FAST_ITERATE_n = (__FAST_ITERATE_count + 7) >> 3; \
switch (__FAST_ITERATE_count & 7) \
{ \
case 0: do { x;\
case 7: x; \
case 6: x; \
case 5: x; \
case 4: x; \
case 3: x; \
case 2: x; \
case 1: x; \
} while (--__FAST_ITERATE_n > 0);\
}\
}\
}

Referenced by makVrv::fasterFind(), and makVrv::fastFindPred().


Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)