00001
00002
00011 #if !defined(__ads_functor_HandleToPointer_h__)
00012 #define __ads_functor_HandleToPointer_h__
00013
00014 #include "../defs.h"
00015
00016 #include <iterator>
00017 #include <functional>
00018
00019 BEGIN_NAMESPACE_ADS
00020
00021
00023
00024
00026
00031 template < typename Handle,
00032 typename Pointer = typename
00033 std::iterator_traits<Handle>::pointer >
00034 struct HandleToPointer :
00035 public std::unary_function<Handle,Pointer>
00036 {
00038 typedef std::unary_function<Handle,Pointer> base_type;
00040 typedef typename base_type::argument_type argument_type;
00042 typedef typename base_type::result_type result_type;
00043
00045 result_type
00046 operator()( argument_type x ) const
00047 {
00048 return &*x;
00049 }
00050 };
00051
00053
00065 template < typename Handle>
00066 inline
00067 HandleToPointer<Handle>
00068 handle_to_pointer()
00069 {
00070 return HandleToPointer<Handle>();
00071 }
00072
00073
00074
00075 END_NAMESPACE_ADS
00076
00077 #endif