/** * PANDA 3D SOFTWARE * Copyright (c) Carnegie Mellon University. All rights reserved. * * All use of this software is subject to the terms of the revised BSD * license. You should have received a copy of this license along * with this source code in a file named "LICENSE." * * @file memory * @author tobspr * @date 2016-11-01 */ // This file, and all the other files in this directory, aren't // intended to be compiled--they're just parsed by CPPParser (and // interrogate) in lieu of the actual system headers, to generate the // interrogate database. #ifndef ALLOCATOR_H #define ALLOCATOR_H #include #include #ifdef GCC_STYLE_ALLOCATOR class alloc { public: static void *allocate(size_t n); static void deallocate(void *p, size_t n); }; #else // GCC_STYLE_ALLOCATOR namespace std { // pointer traits template struct pointer_traits; template struct pointer_traits; // pointer safety enum class pointer_safety { relaxed, preferred, strict }; // allocator argument tag struct allocator_arg_t { }; constexpr allocator_arg_t allocator_arg = allocator_arg_t(); // uses_allocator template struct uses_allocator; // allocator traits template struct allocator_traits; // the default allocator: template class allocator; template <> class allocator; // raw storage iterator: template class raw_storage_iterator; // class template unique_ptr: template class default_delete; template class default_delete; template > class unique_ptr; template class unique_ptr; // class bad_weak_ptr: class bad_weak_ptr; // class template shared_ptr: template class shared_ptr; // class template weak_ptr: template class weak_ptr; // class template owner_less: template class owner_less; // class template enable_shared_from_this: template class enable_shared_from_this; // hash support template struct hash; template struct hash >; template struct hash >; // auto_ptr (deprecated) template class auto_ptr; template struct pointer_traits { typedef Ptr pointer; typedef Ptr element_type; typedef ptrdiff_t difference_type; template using rebind = U; }; template struct pointer_traits { typedef T* pointer; typedef T element_type; typedef ptrdiff_t difference_type; template using rebind = U*; }; template struct allocator_traits { typedef Alloc allocator_type; typedef typename Alloc::value_type value_type; typedef void* pointer; typedef const void* const_pointer; typedef void* void_pointer; typedef const void* const_void_pointer; typedef std::ptrdiff_t difference_type; typedef size_t size_type; struct propagate_on_container_copy_assignment; struct propagate_on_container_move_assignment; struct propagate_on_container_swap; struct is_always_equal; template using rebind_alloc = size_t; //template using rebind_traits = allocator_traits >; }; template class allocator; // specialize for void: template <> class allocator { public: typedef void* pointer; typedef const void* const_pointer; // reference-to-void members are impossible. typedef void value_type; template struct rebind { typedef allocator other; }; }; template class allocator { public: struct true_type_; // do not depend on type_traits header typedef size_t size_type; typedef ptrdiff_t difference_type; typedef T* pointer; typedef const T* const_pointer; typedef T& reference; typedef const T& const_reference; typedef T value_type; template struct rebind { typedef allocator other; }; typedef true_type_ propagate_on_container_move_assignment; typedef true_type_ is_always_equal; }; template class raw_storage_iterator : public iterator { public: }; template struct default_delete {}; template struct default_delete {}; // unique_ptr for single objects template > class unique_ptr { public: typedef T* pointer; typedef T element_type; typedef D deleter_type; }; class bad_weak_ptr: public std::exception {}; template class shared_ptr { public: typedef T element_type; }; template class weak_ptr { public: typedef T element_type; }; template class enable_shared_from_this {}; } #endif // GCC_STYLE_ALLOCATOR #endif