<commit_before>/**********************************************************\

  This file is distributed under the MIT License.
  See accompanying file LICENSE for details.

  momo/stdish/node_handle.h

\**********************************************************/

#pragma once

#include "../SetUtility.h"
#include "../MapUtility.h"

namespace momo
{

namespace stdish
{

namespace internal
{
	template<typename TSetExtractedItem>
	class set_node_handle
	{
	private:
		typedef TSetExtractedItem SetExtractedItem;

	public:
		typedef typename SetExtractedItem::Item value_type;
		typedef typename SetExtractedItem::MemManager::Allocator allocator_type;

	public:
		set_node_handle() MOMO_NOEXCEPT
		{
		}

		set_node_handle(set_node_handle&& node) //MOMO_NOEXCEPT_IF
			: mSetExtractedItem(std::move(node.mSetExtractedItem))
		{
		}

		template<typename Set>
		set_node_handle(Set& set, typename Set::const_iterator iter)
		{
			set.get_nested_container().Remove(iter, mSetExtractedItem);
		}

		~set_node_handle() MOMO_NOEXCEPT
		{
		}

		set_node_handle& operator=(const set_node_handle&) = delete;

		bool empty() const MOMO_NOEXCEPT
		{
			return mSetExtractedItem.IsEmpty();
		}

		explicit operator bool() const MOMO_NOEXCEPT
		{
			return empty();
		}

		allocator_type get_allocator() const
		{
			return allocator_type(mSetExtractedItem.GetMemManager().GetCharAllocator());
		}

		value_type& value() const
		{
			return mSetExtractedItem.GetItem();
		}

	private:
		mutable SetExtractedItem mSetExtractedItem;
	};

	template<typename TMapExtractedPair>
	class map_node_handle
	{
	private:
		typedef TMapExtractedPair MapExtractedPair;

	public:
		typedef typename MapExtractedPair::Key key_type;
		typedef typename MapExtractedPair::Value mapped_type;
		typedef typename MapExtractedPair::MemManager::Allocator allocator_type;

	public:
		map_node_handle() MOMO_NOEXCEPT
		{
		}

		map_node_handle(map_node_handle&& node) //MOMO_NOEXCEPT_IF
			: mMapExtractedPair(std::move(node.mMapExtractedPair))
		{
		}

		template<typename Map>
		map_node_handle(Map& map, typename Map::const_iterator iter)
		{
			map.get_nested_container().Remove(iter.GetBaseIterator(), mMapExtractedPair);
		}

		~map_node_handle() MOMO_NOEXCEPT
		{
		}

		map_node_handle& operator=(const map_node_handle&) = delete;

		bool empty() const MOMO_NOEXCEPT
		{
			return mMapExtractedPair.IsEmpty();
		}

		explicit operator bool() const MOMO_NOEXCEPT
		{
			return empty();
		}

		allocator_type get_allocator() const
		{
			return allocator_type(mMapExtractedPair.GetMemManager().GetCharAllocator());
		}

		key_type& key() const
		{
			return mMapExtractedPair.GetKey();
		}

		mapped_type& mapped() const
		{
			return mMapExtractedPair.GetValue();
		}

	private:
		mutable MapExtractedPair mMapExtractedPair;
	};
}

} // namespace stdish

} // namespace momo<commit_msg>node_handle<commit_after>/**********************************************************\

  This file is distributed under the MIT License.
  See accompanying file LICENSE for details.

  momo/stdish/node_handle.h

\**********************************************************/

#pragma once

#include "../SetUtility.h"
#include "../MapUtility.h"

namespace momo
{

namespace stdish
{

namespace internal
{
	template<typename TSetExtractedItem>
	class set_node_handle
	{
	private:
		typedef TSetExtractedItem SetExtractedItem;

	public:
		typedef typename SetExtractedItem::Item value_type;
		typedef typename SetExtractedItem::MemManager::Allocator allocator_type;

	public:
		set_node_handle() MOMO_NOEXCEPT
		{
		}

		set_node_handle(set_node_handle&& node) //MOMO_NOEXCEPT_IF
			: mSetExtractedItem(std::move(node.mSetExtractedItem))
		{
		}

		set_node_handle(const set_node_handle&) = delete;

		template<typename Set>
		set_node_handle(Set& set, typename Set::const_iterator iter)
		{
			set.get_nested_container().Remove(iter, mSetExtractedItem);
		}

		~set_node_handle() MOMO_NOEXCEPT
		{
		}

		//set_node_handle& operator=(set_node_handle&&)

		set_node_handle& operator=(const set_node_handle&) = delete;

		bool empty() const MOMO_NOEXCEPT
		{
			return mSetExtractedItem.IsEmpty();
		}

		explicit operator bool() const MOMO_NOEXCEPT
		{
			return empty();
		}

		allocator_type get_allocator() const
		{
			return allocator_type(mSetExtractedItem.GetMemManager().GetCharAllocator());
		}

		value_type& value() const
		{
			return mSetExtractedItem.GetItem();
		}

		//void swap(set_node_handle&)
		//friend void swap(set_node_handle&, set_node_handle&)

	private:
		mutable SetExtractedItem mSetExtractedItem;
	};

	template<typename TMapExtractedPair>
	class map_node_handle
	{
	private:
		typedef TMapExtractedPair MapExtractedPair;

	public:
		typedef typename MapExtractedPair::Key key_type;
		typedef typename MapExtractedPair::Value mapped_type;
		typedef typename MapExtractedPair::MemManager::Allocator allocator_type;

	public:
		map_node_handle() MOMO_NOEXCEPT
		{
		}

		map_node_handle(map_node_handle&& node) //MOMO_NOEXCEPT_IF
			: mMapExtractedPair(std::move(node.mMapExtractedPair))
		{
		}

		map_node_handle(const map_node_handle&) = delete;

		template<typename Map>
		map_node_handle(Map& map, typename Map::const_iterator iter)
		{
			map.get_nested_container().Remove(iter.GetBaseIterator(), mMapExtractedPair);
		}

		~map_node_handle() MOMO_NOEXCEPT
		{
		}

		//map_node_handle& operator=(map_node_handle&&)

		map_node_handle& operator=(const map_node_handle&) = delete;

		bool empty() const MOMO_NOEXCEPT
		{
			return mMapExtractedPair.IsEmpty();
		}

		explicit operator bool() const MOMO_NOEXCEPT
		{
			return empty();
		}

		allocator_type get_allocator() const
		{
			return allocator_type(mMapExtractedPair.GetMemManager().GetCharAllocator());
		}

		key_type& key() const
		{
			return mMapExtractedPair.GetKey();
		}

		mapped_type& mapped() const
		{
			return mMapExtractedPair.GetValue();
		}

		//void swap(map_node_handle&)
		//friend void swap(map_node_handle&, map_node_handle&)

	private:
		mutable MapExtractedPair mMapExtractedPair;
	};
}

} // namespace stdish

} // namespace momo
{'fraction_non_alphanumeric': 0.1328740157480315, 'fraction_numerical': 0.0, 'mean_word_length': 4.902226524685382, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7216479', 'n_tokens_mistral': 2315, 'n_tokens_neox': 2026, 'n_words': 367}