The template parameter \p Type should be rebindable.
Implementations:
- - opt::v::static_buffer
- - opt::v::dynamic_buffer
+ - \p opt::v::static_buffer
+ - \p opt::v::dynamic_buffer
*/
template <typename Type>
struct buffer {
namespace v {
- /// Static buffer (see \p cds::opt::buffer option)
+ /// Static buffer
/**
- One of available type for opt::buffer type-option.
+ One of available type for \p opt::buffer option.
This buffer maintains static array. No dynamic memory allocation performed.
struct rebind {
typedef static_buffer<Q, Capacity2, Exp22> other ; ///< Rebind result type
};
+
+ // Capacity must be power of 2
+ static_assert(!c_bExp2 || (c_nCapacity & (c_nCapacity - 1)) == 0, "Capacity must be power of two");
+
private:
//@cond
value_type m_buffer[c_nCapacity];
//@endcond
public:
/// Construct static buffer
- static_buffer()
- {
- // Capacity must be power of 2
- static_assert( !c_bExp2 || (c_nCapacity & (c_nCapacity - 1)) == 0, "Capacity must be power of two" );
- }
+ static_buffer() CDS_NOEXCEPT
+ {}
/// Construct buffer of given capacity
/**
This ctor ignores \p nCapacity argument. The capacity of static buffer
is defined by template argument \p Capacity
*/
- static_buffer( size_t nCapacity )
+ static_buffer( size_t nCapacity ) CDS_NOEXCEPT
{
CDS_UNUSED( nCapacity );
- // Capacity must be power of 2
- static_assert( !c_bExp2 || (c_nCapacity & (c_nCapacity - 1)) == 0, "Capacity must be power of two");
- //assert( c_nCapacity == nCapacity );
}
+ static_buffer( const static_buffer& ) = delete;
+ static_buffer& operator =( const static_buffer& ) = delete;
+
/// Get item \p i
value_type& operator []( size_t i )
{
}
/// Returns pointer to buffer array
- value_type * buffer()
+ value_type * buffer() CDS_NOEXCEPT
{
return m_buffer;
}
- /// Returns pointer to buffer array (const version)
- value_type * buffer() const
+ /// Returns pointer to buffer array
+ value_type * buffer() const CDS_NOEXCEPT
{
return m_buffer;
}
-
- private:
- //@cond
- // non-copyable
- static_buffer(const static_buffer&);
- void operator =(const static_buffer&);
- //@endcond
};
/// Dynamically allocated buffer
/**
- One of available \p cds::opt::buffer type-option.
+ One of available type for \p opt::buffer option.
This buffer maintains dynamically allocated array.
Allocation is performed at construction time.
a.Delete( m_buffer, m_nCapacity );
}
+ dynamic_buffer( const dynamic_buffer& ) = delete;
+ dynamic_buffer& operator =( const dynamic_buffer& ) = delete;
+
/// Get item \p i
value_type& operator []( size_t i )
{
}
/// Returns pointer to buffer array
- value_type * buffer()
+ value_type * buffer() CDS_NOEXCEPT
{
return m_buffer;
}
- /// Returns pointer to buffer array (const version)
- value_type * buffer() const
+ /// Returns pointer to buffer array
+ value_type * buffer() const CDS_NOEXCEPT
{
return m_buffer;
}
-
- private:
- //@cond
- // non-copyable
- dynamic_buffer(const dynamic_buffer&);
- void operator =(const dynamic_buffer&);
- //@endcond
};
} // namespace v
/**
The option sets a type of a functor to compare keys.
For comparing two keys \p k1 and \p k2 the functor must return:
- - 1 if k1 > k2
- - 0 if k1 == k2
- - -1 if k1 < k2
+ - 1 if <tt> k1 > k2 </tt>
+ - 0 if <tt> k1 == k2 </tt>
+ - -1 if <tt> k1 < k2 </tt>
\p Functor is a functor with following interface:
\code
Note that the functor must return \p int, not a \p bool value.
There are predefined type for \p Functor:
- - the functor v::less_comparator that implements comparing functor through \p std::less predicate.
- - the specialization of v::less_comparator functor intended for the string comparison
+ - the functor \p opt::v::less_comparator that implements comparing functor through \p std::less predicate.
+ - the specialization of \p opt::v::less_comparator functor intended for the string comparison
You may implement your own comparing functor that satisfies \p Functor interface.
- About relation between \ref opt::less and \ref opt::compare option setters see opt::less description.
+ About relation between \p %opt::less and \p %opt::compare option setters see \p opt::less description.
*/
template <typename Functor>
struct compare {
/// Comparator specialization for \p std::string
/**
- This functor uses \p std::string::compare method instead of \p std::less predicate.
+ This functor uses \p std::string::compare() method instead of \p std::less predicate.
*/
template <typename T, typename Traits, typename Alloc>
struct less_comparator< std::basic_string<T, Traits, Alloc> >
Generally, the default type for \p Functor is \p std::less but it depends on the container used.
- \par Relation between \p opt::less and opt::compare option setters
- Unless otherwise specified, \p compare option setter has high priority. If opt::compare and opt::less options are specified
- for a container, the opt::compare option is used:
+ \par Relation between opt::less and opt::compare option setters
+ Unless otherwise specified, \p opt::compare option setter has high priority.
+ If \p %opt::compare and \p %opt::less options are specified for a container, the \p %opt::compare option is used:
\code
- // Suppose, hypothetical map_type allows to specify
+ // Suppose, a hypothetical map_type allows to specify
// cds::opt::less and cds::opt::compare options
typedef map_type< std::string, int,
} // namespace details
//@endcond
- /// [type-option] Option setter for \p equal_to predicate
+ /// [type-option] Option setter for \p opt::equal_to predicate
/**
The option sets a binary predicate that tests whether a value of a specified type is equal to another value of that type.
\p Functor interface is similar to \p std::equal_to predicate interface.
template <typename Functor> struct hash< std::tuple<Functor> >;
//@endcond
- /// Multi-functor hash option setter - specialization for std::tuple
+ /// Multi-functor hash option setter - specialization for \p std::tuple
template <typename... Functors>
struct hash< std::tuple<Functors...> >
{
};
\endcode
- Usage example:
+ <b>Usage example</b>
+
The permutation generator is intended for <tt>do {} while</tt> loop:
\code
permutation_generator gen( 16 );
\endcode
The following \p Generator defined:
- - opt::v::random_permutation
- - opt::v::random2_permutation
- - opt::v::random_shuffle_permutation
- - opt::v::skew_permutation
+ - \p opt::v::random_permutation
+ - \p opt::v::random2_permutation
+ - \p opt::v::random_shuffle_permutation
+ - \p opt::v::skew_permutation
*/
template <typename Generator>
struct permutation_generator {
/// Empty cleaner
/**
- One of available type for opt::value_cleaner option.
+ One of available type for \p opt::value_cleaner option.
This cleaner is empty, i.e. it does not do any cleaning.
*/
struct empty_cleaner
/// Cleaner that calls destructor of type \p T
/**
- One of available type for opt::value_cleaner option.
+ One of available type for \p opt::value_cleaner option.
*/
struct destruct_cleaner
{