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_IMPL_LAZY_KVLIST_H
typedef typename base_class::item_counter item_counter; ///< Item counter type
typedef typename maker::key_comparator key_comparator; ///< key comparing functor
typedef typename base_class::memory_model memory_model; ///< Memory ordering. See \p cds::opt::memory_model
+ typedef typename base_class::stat stat; ///< Internal statistics
+
+ static CDS_CONSTEXPR const size_t c_nHazardPtrCount = base_class::c_nHazardPtrCount; ///< Count of hazard pointer required for the algorithm
protected:
//@cond
- Iterator ensures thread-safety even if you delete the item that iterator points to. However, in case of concurrent
deleting operations it is no guarantee that you iterate all item in the list.
- Therefore, the use of iterators in concurrent environment is not good idea. Use the iterator on the concurrent container
- for debug purpose only.
+ @warning Use this iterator on the concurrent container for debugging purpose only.
The iterator interface to access item data:
- <tt> operator -> </tt> - returns a pointer to \ref value_type for iterator
*/
typedef iterator_type<true> const_iterator;
+ ///@name Forward iterators (only for debugging purpose)
+ //@{
/// Returns a forward iterator addressing the first element in a list
/**
For empty list \code begin() == end() \endcode
}
/// Returns a forward const iterator addressing the first element in a list
- //@{
const_iterator begin() const
{
const_iterator it( head() );
++it; // skip dummy head
return it;
}
+
+ /// Returns a forward const iterator addressing the first element in a list
const_iterator cbegin() const
{
const_iterator it( head() );
++it; // skip dummy head
return it;
}
- //@}
/// Returns an const iterator that addresses the location succeeding the last element in a list
- //@{
const_iterator end() const
{
return const_iterator( tail());
}
+
+ /// Returns an const iterator that addresses the location succeeding the last element in a list
const_iterator cend() const
{
return const_iterator( tail());
}
- //@}
+ //@}
public:
/// Default constructor
LazyKVList()
{}
+ //@cond
+ template <typename Stat, typename = std::enable_if<std::is_same<stat, lazy_list::wrapped_stat<Stat>>::value >>
+ explicit LazyKVList( Stat& st )
+ : base_class( st )
+ {}
+ //@endcond
+
/// Destructor clears the list
~LazyKVList()
{
during \p func call \p item is locked so it is safe to modify the item in
multi-threaded environment.
- Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
+ Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successful,
\p second is true if new item has been added or \p false if the item with \p key
already exists.
*/
return base_class::size();
}
+ /// Returns const reference to internal statistics
+ stat const& statistics() const
+ {
+ return base_class::statistics();
+ }
+
/// Clears the list
void clear()
{