From 3b100679693b6ad9adfedbb871a76886b40163b3 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 21 Nov 2015 12:57:39 +0300 Subject: [PATCH] Some minor changes in options doc --- cds/opt/buffer.h | 58 +++++++++++++++++------------------------ cds/opt/compare.h | 24 ++++++++--------- cds/opt/hash.h | 2 +- cds/opt/permutation.h | 11 ++++---- cds/opt/value_cleaner.h | 4 +-- 5 files changed, 45 insertions(+), 54 deletions(-) diff --git a/cds/opt/buffer.h b/cds/opt/buffer.h index 9dca22ff..1563f233 100644 --- a/cds/opt/buffer.h +++ b/cds/opt/buffer.h @@ -19,8 +19,8 @@ namespace cds { namespace opt { 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 struct buffer { @@ -34,9 +34,9 @@ namespace cds { namespace opt { 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. @@ -60,30 +60,31 @@ namespace cds { namespace opt { struct rebind { typedef static_buffer 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 ) { @@ -111,29 +112,22 @@ namespace cds { namespace opt { } /// 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. @@ -191,6 +185,9 @@ namespace cds { namespace opt { 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 ) { @@ -218,23 +215,16 @@ namespace cds { namespace opt { } /// 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 diff --git a/cds/opt/compare.h b/cds/opt/compare.h index 24e5775e..d332b0d3 100644 --- a/cds/opt/compare.h +++ b/cds/opt/compare.h @@ -19,9 +19,9 @@ namespace cds { namespace opt { /** 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 k1 > k2 + - 0 if k1 == k2 + - -1 if k1 < k2 \p Functor is a functor with following interface: \code @@ -36,12 +36,12 @@ namespace cds { namespace opt { 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 struct compare { @@ -75,7 +75,7 @@ namespace cds { namespace opt { /// 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 struct less_comparator< std::basic_string > @@ -121,11 +121,11 @@ namespace cds { namespace opt { 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, @@ -210,7 +210,7 @@ namespace cds { namespace opt { } // 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. diff --git a/cds/opt/hash.h b/cds/opt/hash.h index 5d93bf26..5e309e80 100644 --- a/cds/opt/hash.h +++ b/cds/opt/hash.h @@ -111,7 +111,7 @@ namespace cds { namespace opt { template struct hash< std::tuple >; //@endcond - /// Multi-functor hash option setter - specialization for std::tuple + /// Multi-functor hash option setter - specialization for \p std::tuple template struct hash< std::tuple > { diff --git a/cds/opt/permutation.h b/cds/opt/permutation.h index 861254a9..43d5afee 100644 --- a/cds/opt/permutation.h +++ b/cds/opt/permutation.h @@ -34,7 +34,8 @@ namespace cds { namespace opt { }; \endcode - Usage example: + Usage example + The permutation generator is intended for do {} while loop: \code permutation_generator gen( 16 ); @@ -53,10 +54,10 @@ namespace cds { namespace opt { \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 struct permutation_generator { diff --git a/cds/opt/value_cleaner.h b/cds/opt/value_cleaner.h index 414c5eb3..768abe48 100644 --- a/cds/opt/value_cleaner.h +++ b/cds/opt/value_cleaner.h @@ -42,7 +42,7 @@ namespace cds { namespace opt { /// 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 @@ -56,7 +56,7 @@ namespace cds { namespace opt { /// 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 { -- 2.34.1