cont_ptr_utils.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00040 #ifndef _CONT_PTR_UTILS_H
00041 #define _CONT_PTR_UTILS_H
00042
00055 struct dereference
00056 {
00057 template <typename _Tp>
00058 const _Tp& operator()(const _Tp* __ptr) const
00059 {
00060 return *__ptr;
00061 }
00062 };
00063
00077 struct dereference_less
00078 {
00079 template <typename _Pointer>
00080 bool operator()(_Pointer __ptr1, _Pointer __ptr2) const
00081 {
00082 return *__ptr1 < *__ptr2;
00083 }
00084 };
00085
00096 struct delete_object
00097 {
00098 template <typename _Pointer>
00099 void operator()(_Pointer __ptr) const
00100 {
00101 delete __ptr;
00102 }
00103 };
00104
00115 template <typename _OutputStrm, typename _StringType = const char*>
00116 struct output_object
00117 {
00118 output_object(_OutputStrm& __outs, const _StringType& __sep)
00119 : _M_outs(__outs), _M_sep(__sep)
00120 {}
00121
00122 template <typename _Tp>
00123 void operator()(const _Tp* __ptr) const
00124 {
00125 _M_outs << *__ptr << _M_sep;
00126 }
00127
00128 private:
00129 _OutputStrm& _M_outs;
00130 _StringType _M_sep;
00131 };
00132
00133 #endif // _CONT_PTR_UTILS_H