x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
static_move_ptr.hpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\ptr_container\detail\static_move_ptr.hpp
Girar
Efecto
Propiedad
Historial
// (C) Copyright Thorsten Ottosen 2005. // (C) Copyright Jonathan Turkanis 2004. // (C) Copyright Daniel Wallin 2004. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) // Implementation of the move_ptr from the "Move Proposal" // (http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1377.htm) // enhanced to support custom deleters and safe boolean conversions. // // The implementation is based on an implementation by Daniel Wallin, at // "http://aspn.activestate.com/ASPN/Mail/Message/Attachments/boost/ // 400DC271.1060903@student.umu.se/move_ptr.hpp". The current was adapted // by Jonathan Turkanis to incorporating ideas of Howard Hinnant and // Rani Sharoni. #ifndef BOOST_STATIC_MOVE_PTR_HPP_INCLUDED #define BOOST_STATIC_MOVE_PTR_HPP_INCLUDED #include
// Member template friends, put size_t in std. #include
// size_t #include
#include
#include
#include
#include
#include
#include
#if defined(BOOST_MSVC) #pragma warning(push) #pragma warning(disable:4521) // Multiple copy constuctors. #endif namespace boost { namespace ptr_container_detail { template< typename T, typename Deleter = move_ptrs::default_deleter
> class static_move_ptr { public: typedef typename remove_bounds
::type element_type; typedef Deleter deleter_type; private: struct safe_bool_helper { int x; }; typedef int safe_bool_helper::* safe_bool; typedef boost::compressed_pair
impl_type; public: typedef typename impl_type::second_reference deleter_reference; typedef typename impl_type::second_const_reference deleter_const_reference; // Constructors static_move_ptr() : impl_(0) { } static_move_ptr(const static_move_ptr& p) : impl_(p.get(), p.get_deleter()) { const_cast
(p).release(); } #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) static_move_ptr( const move_ptrs::move_source
>& src ) #else static_move_ptr( const move_ptrs::move_source
& src ) #endif : impl_(src.ptr().get(), src.ptr().get_deleter()) { src.ptr().release(); } template
explicit static_move_ptr(TT* tt) : impl_(tt, Deleter()) { } // Destructor ~static_move_ptr() { if (ptr()) get_deleter()(ptr()); } // Assignment static_move_ptr& operator=(static_move_ptr rhs) { rhs.swap(*this); return *this; } // Smart pointer interface element_type* get() const { return ptr(); } element_type& operator*() { /*BOOST_STATIC_ASSERT(!is_array);*/ return *ptr(); } const element_type& operator*() const { /*BOOST_STATIC_ASSERT(!is_array);*/ return *ptr(); } element_type* operator->() { /*BOOST_STATIC_ASSERT(!is_array);*/ return ptr(); } const element_type* operator->() const { /*BOOST_STATIC_ASSERT(!is_array);*/ return ptr(); } element_type* release() { element_type* result = ptr(); ptr() = 0; return result; } void reset() { if (ptr()) get_deleter()(ptr()); ptr() = 0; } template
void reset(TT* tt) { static_move_ptr(tt).swap(*this); } template
void reset(TT* tt, DD dd) { static_move_ptr(tt, dd).swap(*this); } operator safe_bool() const { return ptr() ? &safe_bool_helper::x : 0; } void swap(static_move_ptr& p) { impl_.swap(p.impl_); } deleter_reference get_deleter() { return impl_.second(); } deleter_const_reference get_deleter() const { return impl_.second(); } private: template
void check(const static_move_ptr
& ptr) { typedef move_ptrs::is_smart_ptr_convertible
convertible; BOOST_STATIC_ASSERT(convertible::value); } #if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) || defined(BOOST_NO_SFINAE) // give up on this behavior #else template
struct cant_move_from_const; template
struct cant_move_from_const< const static_move_ptr
> { typedef typename static_move_ptr
::error type; }; template
static_move_ptr(Ptr&, typename cant_move_from_const
::type = 0); public: static_move_ptr(static_move_ptr&); private: template
static_move_ptr( static_move_ptr
&, typename move_ptrs::enable_if_convertible< TT, T, static_move_ptr& >::type::type* = 0 ); #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING || BOOST_NO_SFINAE //#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS // template
// friend class static_move_ptr; //#else public: //#endif typename impl_type::first_reference ptr() { return impl_.first(); } typename impl_type::first_const_reference ptr() const { return impl_.first(); } impl_type impl_; }; } // namespace ptr_container_detail } // End namespace boost. #if defined(BOOST_MSVC) #pragma warning(pop) // #pragma warning(disable:4251) #endif #endif // #ifndef BOOST_STATIC_MOVE_PTR_HPP_INCLUDED
static_move_ptr.hpp
Dirección de la página
Dirección del archivo
Anterior
11/13
Siguiente
Descargar
( 6 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.