uniq_pointer.hh
Go to the documentation of this file.
00001 /* -*- C++ -*-
00002  * $Id: uniq_pointer.hh 957 2005-03-07 16:01:20Z sjoyeux $
00003  */
00004 #ifndef UTILMM_SMART_UNIQ_POINTER_HEADER
00005 # define UTILMM_SMART_UNIQ_POINTER_HEADER
00006 #include "utilmm/config/config.h"
00007 
00008 #include "utilmm/smart/bits/ref_count_manager.hh"
00009 #include "utilmm/smart/bits/uniq_memory.hh"
00010 #include "utilmm/smart/pointer.hh"
00011 
00012 namespace utilmm {
00013   namespace smart {
00014 
00046     template< typename Ty, class Hash=hash<Ty>, class Equal=std::equal_to<Ty> >
00047     struct uniq_pointer {
00048     private:
00049       typedef ref_count::uniq_memory<Ty, Hash, Equal> mem_type;
00050       typedef ref_count::manager<mem_type> manager_type;
00051       
00052     public:
00058       typedef pointer<manager_type> type; 
00059     }; // struct utilmm::smart::uniq_pointer
00060 
00061   }; // namespace utilmm::smart
00062 
00063   template<class Manager>
00064   struct hash< smart::pointer<Manager> >
00065     :public std::unary_function<smart::pointer<Manager>, size_t> {
00066     size_t operator()(smart::pointer<Manager> const &x) const {
00067       hash< typename smart::pointer<Manager>::pointer_type > hf;
00068 
00069       return size_t(x.null()?0:hf(x));
00070     }
00071   }; // struc utilmm::hash< smart::pointer<> >
00072 
00073 } // namespace utilmm
00074 
00075 #endif // UTILMM_SMART_UNIQ_POINTER_HEADER
00076 


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Mon Oct 6 2014 03:17:01