Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CDSLIB_OPT_BUFFER_H
/// Get item \p i
value_type& operator []( size_t i )
{
- assert( i < capacity() );
+ assert( i < capacity());
return m_buffer[i].v;
}
/// Get item \p i, const version
const value_type& operator []( size_t i ) const
{
- assert( i < capacity() );
+ assert( i < capacity());
return m_buffer[i].v;
}
/// Zeroize the buffer
void zeroize()
{
- memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]) );
+ memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]));
}
/// Returns pointer to buffer array
/// Get item \p i
value_type& operator []( size_t i )
{
- assert( i < capacity() );
+ assert( i < capacity());
return m_buffer[i];
}
/// Get item \p i, const version
const value_type& operator []( size_t i ) const
{
- assert( i < capacity() );
+ assert( i < capacity());
return m_buffer[i];
}
/// Zeroize the buffer
void zeroize()
{
- memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]) );
+ memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]));
}
/// Returns pointer to buffer array
class uninitialized_dynamic_buffer
{
public:
- typedef T value_type; ///< Value type
+ typedef T value_type; ///< Value type
+ typedef Alloc allocator; ///< Allocator type;
static CDS_CONSTEXPR const bool c_bExp2 = Exp2; ///< \p Exp2 flag
/// Rebind buffer for other template parameters
- template <typename Q, typename Alloc2=Alloc, bool Exp22 = c_bExp2>
+ template <typename Q, typename Alloc2= allocator, bool Exp22 = c_bExp2>
struct rebind {
typedef uninitialized_dynamic_buffer<Q, Alloc2, Exp22> other; ///< Rebinding result type
};
//@cond
- typedef typename Alloc::template rebind<value_type>::other allocator_type;
+ typedef typename allocator::template rebind<value_type>::other allocator_type;
//@endcond
private:
/// Get item \p i
value_type& operator []( size_t i )
{
- assert( i < capacity() );
+ assert( i < capacity());
return m_buffer[i];
}
/// Get item \p i, const version
const value_type& operator []( size_t i ) const
{
- assert( i < capacity() );
+ assert( i < capacity());
return m_buffer[i];
}
/// Zeroize the buffer
void zeroize()
{
- memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]) );
+ memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]));
}
/// Returns pointer to buffer array
class initialized_dynamic_buffer
{
public:
- typedef T value_type; ///< Value type
+ typedef T value_type; ///< Value type
+ typedef Alloc allocator; ///< Allocator type
static CDS_CONSTEXPR const bool c_bExp2 = Exp2; ///< \p Exp2 flag
/// Rebind buffer for other template parameters
- template <typename Q, typename Alloc2=Alloc, bool Exp22 = c_bExp2>
+ template <typename Q, typename Alloc2= allocator, bool Exp22 = c_bExp2>
struct rebind {
typedef initialized_dynamic_buffer<Q, Alloc2, Exp22> other; ///< Rebinding result type
};
//@cond
- typedef cds::details::Allocator<value_type, Alloc> allocator_type;
+ typedef cds::details::Allocator<value_type, allocator> allocator_type;
//@endcond
private:
/// Get item \p i
value_type& operator []( size_t i )
{
- assert( i < capacity() );
+ assert( i < capacity());
return m_buffer[i];
}
/// Get item \p i, const version
const value_type& operator []( size_t i ) const
{
- assert( i < capacity() );
+ assert( i < capacity());
return m_buffer[i];
}
/// Zeroize the buffer
void zeroize()
{
- memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]) );
+ memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]));
}
/// Returns pointer to buffer array