mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-08-13 20:27:56 +08:00
Foundation Classes - Tree & collection performance optimizations, move semantics, unified map API (#1065)
NCollection_UBTree/EBTree: - Add move constructor and move assignment operators - Replace recursive Select() and delNode() with iterative stack-based traversal to avoid stack overflow on deeply unbalanced trees - Optimize EBTree::Add() and Remove() to use single-lookup TryEmplaced() instead of double-lookup UnBind()+Bind() / Contains()+operator() - Remove unused DEFINE_HUBTREE / DEFINE_HEBTREE / IMPLEMENT_HUBTREE / IMPLEMENT_HEBTREE macros - Remove unused includes from EBTree (Standard_Type, Standard_Transient, NCollection_List, Standard_Integer, NCollection_Sequence) - Fix doxygen @param tags and comment style NCollection_LocalArray: - Add move constructor and move assignment operators with optimized three-way branching (stack-stack copy, heap-heap swap, stack-heap steal) - Add Reallocate() method supporting grow-with-copy for use as a dynamically growable stack - Add static_assert enforcing trivially copyable element type NCollection_CellFilter: - Replace const_cast destructive-copy hack in Cell with proper move semantics; delete copy constructor and copy assignment - Add Cell constructor from CellIndex for lightweight lookup keys - Refactor add()/iterateAdd() to accept CellIndex instead of Cell, use TryEmplaced() for single-lookup cell insertion - Refactor remove()/inspect() to use Contained() API with const_cast instead of C-style cast on Seek() - Change ListNode default constructor from runtime throw to = delete - Use size_t for dimension loops and add dimension size guard in IsEqual - Remove SUN WorkShop 5.3 workaround - Fix typo "usially" -> "usually" in class documentation NCollection map API unification (Contained, TryEmplace, TryBind): - Add Contained() to all map types returning std::optional with std::reference_wrapper; key-only maps return const key ref, data maps return std::pair of const key ref + value ref - Add TryEmplace()/TryEmplaced() to NCollection_FlatMap and NCollection_IndexedMap for parity with NCollection_Map - Add TryBind() to NCollection_IndexedDataMap for parity with NCollection_DataMap and NCollection_FlatDataMap - Remove Seek()/ChangeSeek() from NCollection_Map (replaced by Contained()) Dead compiler workaround removal: - NCollection_DefineAlloc: remove Borland/SUN #if branch, keep only the version with placement delete - NCollection_SparseArrayBase: remove SUN WorkShop 5.3 workaround GTests: - Add move constructor/assignment tests for LocalArray, UBTree, EBTree - Add Contained tests for NCollection_Map - Add CellFilter tests and UBTree deep-unbalanced-tree stress test
This commit is contained in:
@@ -47,12 +47,7 @@ public:
|
||||
|
||||
//!@}
|
||||
|
||||
#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
|
||||
public: // work-around against obsolete SUN WorkShop 5.3 compiler
|
||||
#else
|
||||
private:
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The block of data contains array of items, counter
|
||||
* and bit field, allocated as single piece of memory addressed
|
||||
|
||||
Reference in New Issue
Block a user