Tidy robin-map

This commit is contained in:
halx99 2021-12-29 11:25:42 +08:00
parent d4e20643ab
commit f8ff6a8481
9 changed files with 93 additions and 6 deletions

View File

@ -179,6 +179,7 @@ add_subdirectory(${ADXE_ROOT_PATH}/extensions ${ENGINE_BINARY_PATH}/extensions)
if(MSVC_IDE)
target_sources(${ADXE_CORE_LIB} PRIVATE ../thirdparty/yasio/yasio.natvis)
target_sources(${ADXE_CORE_LIB} PRIVATE ../thirdparty/robin-map/tsl-robin-map.natvis)
endif()
# copy all thirdparty libraries to ${CMAKE_BINARY_DIR}/lib/$<CONFIG>

View File

@ -37,7 +37,7 @@ struct equal_to
return static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right);
}
using is_transparent = int;
using is_transparent = void;
};
template <typename _Valty>

View File

@ -304,6 +304,7 @@ if(BUILD_DEP_LLHTTP)
target_link_libraries(thirdparty llhttp)
endif()
# yaml
if(BUILD_DEP_YAML_CPP)
set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
@ -316,6 +317,7 @@ if(BUILD_DEP_YAML_CPP)
# target_link_libraries(thirdparty yaml-cpp)
endif()
# kcp
if(BUILD_DEP_KCP)
add_subdirectory(kcp)
configure_target_outdir(kcp)
@ -323,6 +325,7 @@ if(BUILD_DEP_KCP)
target_compile_definitions(thirdparty PUBLIC YASIO_HAVE_KCP=1)
endif()
# fmt-lib
add_subdirectory(fmt)
target_link_libraries(thirdparty fmt-header-only)
configure_target_outdir(fmt)
@ -330,6 +333,9 @@ configure_target_outdir(fmt)
# put "thirdparty" into thirdparty folder, too
configure_target_outdir(thirdparty)
# robin-map
target_include_directories(thirdparty PUBLIC "robin-map/include")
if(MACOSX OR IOS)
add_subdirectory(glsl-optimizer)
target_link_libraries(thirdparty

12
thirdparty/README.md vendored
View File

@ -181,6 +181,13 @@
- Version: git 65b314a (747) with dtCrowd::getEditableAgentAnim
- License: zlib
## robin-map
- Upstream: https://github.com/Tessil/robin-map
- Version: git 0.6.3-84c1bee (101) with modified for more compatible with stl
- Modify `robin_map::iterator->second` to mutable same with `stl map/unordered_map`
- Modify `robin_map::operator[]` key forward by `std::forward` same with `stl map/unordered_map`
- License: MIT
## stb (stb_image)
- Upstream: https://github.com/nothings/stb
- Version: 2.27
@ -191,11 +198,6 @@
- Version: git 1.2.4-ec6bff2 (168)
- License: BSD-2-Clause
## tsl (robin-map)
- Upstream: https://github.com/Tessil/robin-map
- Version: git 0.6.3-84c1bee (100)
- License: MIT
## unzip (minizip-1.2)
- Upstream: https://github.com/simdsoft/mz12
- Version: 1.2 with bugfixs & improvements

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- Written in VC 2017 15.7 but is expected to be compatible with VC 2015 -->
<!-- Visualization that shows the index in the name column and the key-value pair in the value column -->
<Type Name="tsl::robin_map&lt;*&gt;" Priority="Medium">
<AlternativeType Name="tsl::robin_set&lt;*&gt;"/>
<DisplayString>{{ size={m_ht.m_nb_elements} }}</DisplayString>
<Expand>
<Item Name="[bucket_count]" IncludeView="detailed">m_ht.m_buckets_data._Mypair._Myval2._Mylast - m_ht.m_buckets_data._Mypair._Myval2._Myfirst</Item>
<Item Name="[load_factor]" Condition="m_ht.m_buckets_data._Mypair._Myval2._Myfirst != m_ht.m_buckets_data._Mypair._Myval2._Mylast" IncludeView="detailed">
((float)m_ht.m_nb_elements) / ((float)(m_ht.m_buckets_data._Mypair._Myval2._Mylast - m_ht.m_buckets_data._Mypair._Myval2._Myfirst))
</Item>
<Item Name="[load_factor]" Condition="m_ht.m_buckets_data._Mypair._Myval2._Myfirst == m_ht.m_buckets_data._Mypair._Myval2._Mylast" IncludeView="detailed">
0
</Item>
<Item Name="[max_load_factor]" IncludeView="detailed">m_ht.m_max_load_factor</Item>
<CustomListItems>
<Variable Name="bucket" InitialValue="m_ht.m_buckets"/>
<Size>m_ht.m_nb_elements</Size>
<Loop>
<Item Condition="bucket-&gt;m_dist_from_ideal_bucket != -1">*bucket</Item>
<Break Condition="bucket-&gt;m_last_bucket"/>
<Exec>++bucket</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
<!-- Visualization that shows the key in the name column and the key-value pair in the value column -->
<Type Name="tsl::robin_map&lt;*&gt;" ExcludeView="ShowElementsByIndex" Priority="MediumHigh">
<DisplayString>{{ size={m_ht.m_nb_elements} }}</DisplayString>
<Expand>
<Item Name="[bucket_count]" IncludeView="detailed">m_ht.m_buckets_data._Mypair._Myval2._Mylast - m_ht.m_buckets_data._Mypair._Myval2._Myfirst</Item>
<Item Name="[load_factor]" Condition="m_ht.m_buckets_data._Mypair._Myval2._Myfirst != m_ht.m_buckets_data._Mypair._Myval2._Mylast" IncludeView="detailed">
((float)m_ht.m_nb_elements) / ((float)(m_ht.m_buckets_data._Mypair._Myval2._Mylast - m_ht.m_buckets_data._Mypair._Myval2._Myfirst))
</Item>
<Item Name="[load_factor]" Condition="m_ht.m_buckets_data._Mypair._Myval2._Myfirst == m_ht.m_buckets_data._Mypair._Myval2._Mylast" IncludeView="detailed">
0
</Item>
<Item Name="[max_load_factor]" IncludeView="detailed">m_ht.m_max_load_factor</Item>
<CustomListItems>
<Variable Name="bucket" InitialValue="m_ht.m_buckets"/>
<Size>m_ht.m_nb_elements</Size>
<Loop>
<Item Condition="bucket-&gt;m_dist_from_ideal_bucket != -1" Name="[{reinterpret_cast&lt;std::pair&lt;$T1,$T2&gt;*&gt;(&amp;bucket->m_value)->first}]">*bucket</Item>
<Break Condition="bucket-&gt;m_last_bucket"/>
<Exec>++bucket</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
<Type Name="tsl::detail_robin_hash::robin_hash&lt;*&gt;::robin_iterator&lt;*&gt;">
<DisplayString>{*m_bucket}</DisplayString>
<Expand>
<ExpandedItem>*m_bucket</ExpandedItem>
</Expand>
</Type>
<Type Name="tsl::detail_robin_hash::bucket_entry&lt;*&gt;">
<DisplayString Condition="m_dist_from_ideal_bucket == -1">empty</DisplayString>
<DisplayString Condition="m_dist_from_ideal_bucket != -1">{*reinterpret_cast&lt;$T1*&gt;(&amp;m_value)}</DisplayString>
<Expand>
<ExpandedItem Condition="m_dist_from_ideal_bucket != -1">*reinterpret_cast&lt;$T1*&gt;(&amp;m_value)</ExpandedItem>
</Expand>
</Type>
<Type Name="tsl::detail_robin_hash::bucket_entry&lt;*&gt;" IncludeView="MapHelper">
<DisplayString Condition="m_dist_from_ideal_bucket == -1">empty</DisplayString>
<DisplayString Condition="m_dist_from_ideal_bucket != -1">{reinterpret_cast&lt;$T1*&gt;(&amp;m_value)->second}</DisplayString>
<Expand>
<ExpandedItem Condition="m_dist_from_ideal_bucket != -1">*reinterpret_cast&lt;$T1*&gt;(&amp;m_value)</ExpandedItem>
</Expand>
</Type>
</AutoVisualizer>