BinaryTree.hpp #1

  • //
  • guest/
  • ShadauxCat/
  • Sprawl/
  • Mainline/
  • collections/
  • BinaryTree.hpp
  • View
  • Commits
  • Open Download .zip Download (851 B)
#pragma once

//Support for legacy compilers lacking variadic template support
#if (defined(_WIN32) && _MSC_VER < 1800)
/*TODO: Support these too
|| (defined(__clang__) && (__clang_major__ < 2 || (__clang_major__ == 2 && __clang_minor__ < 9))) \
	|| (!defined(__clang__) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3))) \
	|| defined(SPRAWL_NO_VARIADIC_TEMPLATES)*/

#include "binarytree/BinaryTree_Windows.hpp"

namespace sprawl
{
	namespace collections
	{
		//template<typename ValueType>
		//class BinarySet : public BinaryTree<ValueType, SelfAccessor<ValueType>, _MAX_NIL_LIST>
		//{
			//
		//};
	}
}
#else
#include "binarytree/BinaryTree_Variadic.hpp"

namespace sprawl
{
	namespace collections
	{
		//template<typename ValueType>
		//using BinarySet = BinaryTree<ValueType, SelfAccessor<ValueType>>;
	}
}
#endif
# Change User Description Committed
#3 14833 ShadauxCat First checkin of logging module.

Also fixes the following issues:

-Added UpperBound() and LowerBound() to BinaryTree and created appropriate unit tests
-Added Sync() to ThreadManager to force it to run all tasks to completion and not return until it has no tasks left
-Fixed a bug in String::format() where a non-numeric value inside {} would be treated as an empty {}; it now simply prints whatever the value was. (i.e., "{blah}".format(foo) simply returns "{blah}")
-Added Reset() to sprawl::StringBuilder
-Disabled the switch-enum warning flag in gcc because it's stupid and ridiculous that a default case doesn't shut it up
-Made sprawl::Mutex movable. This may turn out to be a bad idea but it enabled keeping them in a map.
-Fixed a name collission between HashMap and BinaryTree; both defined sprawl::collections::detail::UnderlyingType and ::MethodType. Prefixed the ones in BinaryTree with "Tree". This isn't the best solution, but it works for now.

#review-14834
#2 14220 ShadauxCat -Added binary tree implementation (red/black tree) with same multi-key interface as hashmap
-Renamed AccessorGroup to MapAccessorGroup to make room for TreeAccessorGroup, which is a lot of duplicated code but had to meet some specific requirements that couldn't be easily fit into the existing AccessorGroup
-Fixed HashMap::Clear() not resetting size to 0
-Fixed HashMap::Erase() neither decrementing size nor freeing memory
-Changed HashMap to grow before insert instead of after (delaying needed growth until the next insert instead of growing when it detects the next insert will need it)
-Fixed a style issue for private function HashMap_Impl::insertHere_()
-Fully removed support for Visual Studio 2012 as I have neither the need nor the desire to continue supporting it. The doubled maintenance cost is too high.
-Included array unit test that got missed before

#review-14221
#1 11496 ShadauxCat Initial checkin: Current states for csbuild and libSprawl