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_CONTAINER_MICHAEL_KVLIST_NOGC_H
typedef typename base_class::item_counter item_counter; ///< Item counting policy used
typedef typename maker::key_comparator key_comparator; ///< key comparison functor
typedef typename base_class::memory_model memory_model; ///< Memory ordering. See cds::opt::memory_model option
+ typedef typename base_class::stat stat; ///< Internal statistics
protected:
//@cond
//@endcond
public:
+ ///@name Forward iterators
+ //@{
/// Forward iterator
/**
- The forward iterator for Michael's list based on gc::nogc has pre- and post-increment operators.
+ The forward iterator is safe: you may use it in multi-threaded enviromnent without any synchronization.
+
+ The forward iterator for Michael's list based on \p gc::nogc has pre- and post-increment operators.
The iterator interface to access item data:
- - <tt> operator -> </tt> - returns a pointer to \ref value_type for iterator
- - <tt> operator *</tt> - returns a reference (a const reference for \p const_iterator) to \ref value_type for iterator
+ - <tt> operator -> </tt> - returns a pointer to \p value_type
+ - <tt> operator *</tt> - returns a reference (a const reference for \p const_iterator) to \p value_type
- <tt> const key_type& key() </tt> - returns a key reference for iterator
- <tt> mapped_type& val() </tt> - retuns a value reference for iterator (const reference for \p const_iterator)
- For both functions the iterator should not be equal to <tt> end() </tt>
+ For both functions the iterator should not be equal to \p end().
+
+ @note \p end() iterator is not dereferenceable
*/
typedef iterator_type<false> iterator;
}
/// Returns a forward const iterator addressing the first element in a list
- //@{
const_iterator begin() const
{
return const_iterator( head() );
}
+ /// Returns a forward const iterator addressing the first element in a list
const_iterator cbegin() const
{
return const_iterator( head() );
}
- //@}
/// Returns an const iterator that addresses the location succeeding the last element in a list
- //@{
const_iterator end() const
{
return const_iterator();
}
+ /// Returns an const iterator that addresses the location succeeding the last element in a list
const_iterator cend() const
{
return const_iterator();
}
- //@}
+ //@}
protected:
//@cond
MichaelKVList()
{}
- /// List desctructor
+ //@cond
+ template <typename Stat, typename = std::enable_if<std::is_same<stat, michael_list::wrapped_stat<Stat>>::value >>
+ explicit MichaelKVList( Stat& st )
+ : base_class( st )
+ {}
+ //@endcond
+
+ /// List destructor
/**
Clears the list
*/
return base_class::size();
}
+ /// Returns const reference to internal statistics
+ stat const& statistics() const
+ {
+ return base_class::statistics();
+ }
+
/// Clears the list
void clear()
{