mn_smart_pointer_traits.hpp
Go to the documentation of this file.
1 /*
2 *This file is part of the Mini Thread Library (https://github.com/RoseLeBlood/MiniThread ).
3 *Copyright (c) 2021 Amber-Sophia Schroeck
4 *
5 *The Mini Thread Library is free software; you can redistribute it and/or modify
6 *it under the terms of the GNU Lesser General Public License as published by
7 *the Free Software Foundation, version 3, or (at your option) any later version.
8 
9 *The Mini Thread Library is distributed in the hope that it will be useful, but
10 *WITHOUT ANY WARRANTY; without even the implied warranty of
11 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 *General Public License for more details.
13 *
14 *You should have received a copy of the GNU Lesser General Public
15 *License along with the Mini Thread Library; if not, see
16 *<https://www.gnu.org/licenses/>.
17 */
18 #ifndef MINLIB_22d7d658_9601_4b2d_afb1_c4b43d387f33_H_
19 #define MINLIB_22d7d658_9601_4b2d_afb1_c4b43d387f33_H_
20 
21 #include "../mn_config.hpp"
22 
23 #include "../mn_algorithm.hpp"
24 #include "../mn_def.hpp"
25 #include "../utils/mn_addressof.hpp"
26 
27 namespace mn {
28  namespace pointer {
29 
30  template <class TPR>
32  using value_type = typename TPR::value_type;
33  using element_type = typename TPR::element_type;
34  using reference = typename TPR::reference;
35  using const_value_type = typename TPR::const_value_type;
36  using pointer = typename TPR::pointer;
37 
38  static inline element_type* to_address(const TPR& _pPtr) noexcept {
39  return mn::addressof<element_type>(_pPtr.get()); }
40  };
41 
42  template <class TPR>
43  inline typename smart_pointer_traits<TPR>::pointer get_pointer(const TPR& _pPtr) {
44  return _pPtr.get(); }
45 
46  template <class TPR>
47  inline bool is_null(const TPR& _pPtr) {
48  return _pPtr.get() == nullptr; }
49 
50 
51 
52  }
53 }
54 
55 
56 #endif
smart_pointer_traits< TPR >::pointer get_pointer(const TPR &_pPtr)
Definition: mn_smart_pointer_traits.hpp:43
bool is_null(const TPR &_pPtr)
Definition: mn_smart_pointer_traits.hpp:47
Definition: mn_allocator_typetraits.hpp:25
Definition: mn_smart_pointer_traits.hpp:31
typename TPR::element_type element_type
Definition: mn_smart_pointer_traits.hpp:33
typename TPR::value_type value_type
Definition: mn_smart_pointer_traits.hpp:32
typename TPR::pointer pointer
Definition: mn_smart_pointer_traits.hpp:36
typename TPR::reference reference
Definition: mn_smart_pointer_traits.hpp:34
typename TPR::const_value_type const_value_type
Definition: mn_smart_pointer_traits.hpp:35
static element_type * to_address(const TPR &_pPtr) noexcept
Definition: mn_smart_pointer_traits.hpp:38