All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LinearGrowth.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_POLICIES_LINEARGROWTH_H_
36 #define _BLAZE_UTIL_POLICIES_LINEARGROWTH_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 //*************************************************************************************************
62 template< size_t Growth >
64 {
65  //**Utility functions***************************************************************************
68  inline size_t operator()( size_t oldSize, size_t minSize ) const;
70  //**********************************************************************************************
71 };
72 //*************************************************************************************************
73 
74 
75 //*************************************************************************************************
80 template<>
81 struct LinearGrowth<0>;
83 //*************************************************************************************************
84 
85 
86 //*************************************************************************************************
91 template<>
92 struct LinearGrowth<1>;
94 //*************************************************************************************************
95 
96 
97 
98 
99 //=================================================================================================
100 //
101 // UTILITY FUNCTIONS
102 //
103 //=================================================================================================
104 
105 //*************************************************************************************************
112 template< size_t Growth >
113 inline size_t LinearGrowth<Growth>::operator()( size_t old, size_t minimum ) const
114 {
115  const size_t needed( max<size_t>( old*Growth, minimum ) );
116  return ( ( needed )?( 4 * ( (needed-1)/4+1 ) ):( 0 ) );
117 }
118 //*************************************************************************************************
119 
120 } // namespace blaze
121 
122 #endif
Header file for mathematical functions.
Linear growth policy class.The LinearGrowth policy class implements a linear growth strategy...
Definition: LinearGrowth.h:63
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: LinearGrowth.h:113
Header file for basic type definitions.