![]() |
|
|||
File indexing completed on 2024-04-06 11:56:18
0001 #ifndef GENERS_CLEARIFPOINTER_HH_ 0002 #define GENERS_CLEARIFPOINTER_HH_ 0003 0004 namespace gs { 0005 template <class T> 0006 struct ClearIfPointer { 0007 static void clear(T &) {} 0008 }; 0009 0010 template <class T> 0011 struct ClearIfPointer<T *> { 0012 static void clear(T *&ptr) { ptr = 0; } 0013 }; 0014 0015 // The following will set object value to 0 if object is a pointer 0016 template <class T> 0017 void clearIfPointer(T &obj) { 0018 ClearIfPointer<T>::clear(obj); 0019 } 0020 } // namespace gs 0021 0022 #endif // GENERS_CLEARIFPOINTER_HH_
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |
![]() ![]() |