bit::memory
no_growth.hpp
1 /*****************************************************************************
2  * \file
3  * \brief This header contains a null-growth policy
4  *****************************************************************************/
5 
6 /*
7  The MIT License (MIT)
8 
9  Copyright (c) 2018 Matthew Rodusek
10 
11  Permission is hereby granted, free of charge, to any person obtaining a copy
12  of this software and associated documentation files (the "Software"), to deal
13  in the Software without restriction, including without limitation the rights
14  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15  copies of the Software, and to permit persons to whom the Software is
16  furnished to do so, subject to the following conditions:
17 
18  The above copyright notice and this permission notice shall be included in
19  all copies or substantial portions of the Software.
20 
21  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27  SOFTWARE.
28 */
29 #ifndef BIT_MEMORY_POLICIES_GROWTH_MULTIPLIERS_NO_GROWTH_HPP
30 #define BIT_MEMORY_POLICIES_GROWTH_MULTIPLIERS_NO_GROWTH_HPP
31 
32 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
33 # pragma once
34 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
35 
36 #include <cstddef> // std::size_t
37 
38 namespace bit {
39  namespace memory {
40 
48  {
49  //-----------------------------------------------------------------------
50  // Constructors / Assignment
51  //-----------------------------------------------------------------------
52  public:
53 
55  constexpr no_growth_multiplier() noexcept = default;
56 
60  no_growth_multiplier( no_growth_multiplier&& other ) noexcept = default;
61 
65  no_growth_multiplier( const no_growth_multiplier& other ) noexcept = default;
66 
67  //-----------------------------------------------------------------------
68 
74 
79  no_growth_multiplier& operator=( const no_growth_multiplier& other ) = default;
80 
81  //-----------------------------------------------------------------------
82  // Growth
83  //-----------------------------------------------------------------------
84  public:
85 
87  constexpr void grow() noexcept;
88 
92  constexpr std::size_t multiplier() const noexcept;
93  };
94 
95  } // namespace memory
96 } // namespace bit
97 
98 #include "detail/no_growth.inl"
99 
100 #endif /* BIT_MEMORY_POLICIES_GROWTH_MULTIPLIERS_NO_GROWTH_HPP */
A multiplier that doesn&#39;t actually grow.
Definition: no_growth.hpp:47
constexpr no_growth_multiplier() noexcept=default
Default-constructs this growth policy.
no_growth_multiplier & operator=(no_growth_multiplier &&other)=default
Move-assigns this growth policy from an existing one.
constexpr std::size_t multiplier() const noexcept
Returns the multiplier.
constexpr void grow() noexcept
No-op.