ConstantGrowth.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_POLICIES_CONSTANTGROWTH_H_
36 #define _BLAZE_UTIL_POLICIES_CONSTANTGROWTH_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Functions.h>
44 #include <blaze/util/Types.h>
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // CLASS DEFINITION
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
63 template< size_t Growth >
65 {
66  //**Utility functions***************************************************************************
69  inline size_t operator()( size_t oldSize, size_t minSize ) const;
71  //**********************************************************************************************
72 };
73 //*************************************************************************************************
74 
75 
76 //*************************************************************************************************
81 template<>
82 struct ConstantGrowth<0>;
84 //*************************************************************************************************
85 
86 
87 
88 
89 //=================================================================================================
90 //
91 // UTILITY FUNCTIONS
92 //
93 //=================================================================================================
94 
95 //*************************************************************************************************
102 template< size_t Growth >
103 inline size_t ConstantGrowth<Growth>::operator()( size_t old, size_t minimum ) const
104 {
105  const size_t needed( max<size_t>( old+Growth, minimum ) );
106  return ( ( needed )?( 4 * ( (needed-1)/4+1 ) ):( 0 ) );
107 }
108 //*************************************************************************************************
109 
110 } // namespace blaze
111 
112 #endif
Header file for mathematical functions.
Header file for basic type definitions.
size_t operator()(size_t oldSize, size_t minSize) const
Returns a new size depending on the given old size and the required minimum size. ...
Definition: ConstantGrowth.h:103
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Constant growth policy class.The ConstantGrowth policy class implements a constant growth strategy...
Definition: ConstantGrowth.h:64