All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConstantGrowth.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_UTIL_POLICIES_CONSTANTGROWTH_H_
23 #define _BLAZE_UTIL_POLICIES_CONSTANTGROWTH_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
30 #include <blaze/math/Functions.h>
31 #include <blaze/util/Types.h>
32 
33 
34 namespace blaze {
35 
36 //=================================================================================================
37 //
38 // CLASS DEFINITION
39 //
40 //=================================================================================================
41 
42 //*************************************************************************************************
50 template< size_t Growth >
52 {
53  //**Utility functions***************************************************************************
56  inline size_t operator()( size_t oldSize, size_t minSize ) const;
58  //**********************************************************************************************
59 };
60 //*************************************************************************************************
61 
62 
63 //*************************************************************************************************
68 template<>
69 struct ConstantGrowth<0>;
71 //*************************************************************************************************
72 
73 
74 
75 
76 //=================================================================================================
77 //
78 // UTILITY FUNCTIONS
79 //
80 //=================================================================================================
81 
82 //*************************************************************************************************
89 template< size_t Growth >
90 inline size_t ConstantGrowth<Growth>::operator()( size_t old, size_t minimum ) const
91 {
92  const size_t needed( max<size_t>( old+Growth, minimum ) );
93  return ( ( needed )?( 4 * ( (needed-1)/4+1 ) ):( 0 ) );
94 }
95 //*************************************************************************************************
96 
97 } // namespace blaze
98 
99 #endif