diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 83b5399e83..1939e9ee8f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -23,8 +23,8 @@ jobs: - os: macOS-14 name: macOS container: "" - env: "PATH=\"/opt/homebrew/opt/protobuf@3/bin:$PATH\"" - flags: "--preset with-sccache -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DCMAKE_LIBRARY_PATH=/opt/homebrew/opt/protobuf@3/lib -DProtobuf_INCLUDE_DIR=/opt/homebrew/opt/protobuf@3/include -DProtobuf_PROTOC_EXECUTABLE=/opt/homebrew/opt/protobuf@3/bin/protoc" + env: "" + flags: "--preset with-sccache -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON" - os: windows-2022 name: Windows container: "" @@ -40,7 +40,7 @@ jobs: - name: Install dependencies (macOS) if: runner.os == 'macOS' - run: brew install opencv protobuf@3 ninja + run: brew install opencv protobuf@29 ninja - uses: ilammy/msvc-dev-cmd@v1.13.0 if: runner.os == 'Windows' diff --git a/.github/workflows/upstream-utils.yml b/.github/workflows/upstream-utils.yml index 6409faba78..2c99c08965 100644 --- a/.github/workflows/upstream-utils.yml +++ b/.github/workflows/upstream-utils.yml @@ -120,12 +120,6 @@ jobs: ./mpack.py clone ./mpack.py copy-src ./mpack.py format-patch - - name: Run memory.py - run: | - cd upstream_utils - ./memory.py clone - ./memory.py copy-src - ./memory.py format-patch - name: Run protobuf.py run: | cd upstream_utils diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index a14b32a0a1..4e55a063a2 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -4,8 +4,7 @@ As members, contributors, and leaders, we commit to fostering a community where everyone feels safe, respected, and valued. We are dedicated to ensuring that participation in this community is harassment-free, inclusive, and welcoming, regardless of age, body type, abilities (visible or invisible), ethnicity, gender identity or expression, sexual orientation, socioeconomic background, education, nationality, personal appearance, race, or religion. -Above all, we pledge to act with integrity, kindness, and empathy—striving to be not only good participants but also good humans. - +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index 91bd7a2fb1..f927bf85ae 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -48,14 +48,13 @@ apriltag apriltag/src/main/native/thirdparty/apriltag glfw thirdparty/imgui_suite/glfw Dear ImGui thirdparty/imgui_suite/imgui implot thirdparty/imgui_suite/implot -memory wpiutil/src/main/native/thirdparty/memory nanopb wpiutil/src/main/native/thirdparty/nanopb protobuf wpiutil/src/main/native/thirdparty/protobuf mrcal wpical/src/main/native/thirdparty/mrcal libdogleg wpical/src/main/native/thirdparty/libdogleg Simd hal/src/main/native/athena/simd -Additionally, glfw, memory, and nanopb were all modified for use in WPILib. +Additionally, glfw and nanopb were modified for use in WPILib. ============================================================================== Google Test License @@ -1331,31 +1330,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -============== -memory License -============== -Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors - -This software is provided 'as-is', without any express or -implied warranty. In no event will the authors be held -liable for any damages arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute -it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; - you must not claim that you wrote the original software. - If you use this software in a product, an acknowledgment - in the product documentation would be appreciated but - is not required. - -2. Altered source versions must be plainly marked as such, - and must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any - source distribution. - ============== nanopb License ============== diff --git a/cmake/modules/CompileWarnings.cmake b/cmake/modules/CompileWarnings.cmake index 5e57d292c9..e7ea1b533a 100644 --- a/cmake/modules/CompileWarnings.cmake +++ b/cmake/modules/CompileWarnings.cmake @@ -47,7 +47,14 @@ macro(wpilib_target_warnings target) # Suppress warning "enumeration types with a fixed underlying type are a # Clang extension" if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT EMSCRIPTEN) - target_compile_options(${target} PRIVATE $<$:-Wno-fixed-enum-extension>) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20.0) + target_compile_options( + ${target} + PRIVATE $<$:-Wno-fixed-enum-extension> + ) + else() + target_compile_options(${target} PRIVATE $<$:-Wno-c23-extensions>) + endif() endif() # Compress debug info with GCC diff --git a/docs/build.gradle b/docs/build.gradle index f161c42168..e8c78c49ab 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -136,9 +136,6 @@ doxygen { exclude 'wpi/ordered_map.h' exclude 'wpi/thirdparty/**' - // memory - exclude 'wpi/memory/**' - // mpack exclude 'wpi/mpack.h' diff --git a/glass/src/libnt/native/cpp/NTMechanism2D.cpp b/glass/src/libnt/native/cpp/NTMechanism2D.cpp index d98da48d47..a963c28895 100644 --- a/glass/src/libnt/native/cpp/NTMechanism2D.cpp +++ b/glass/src/libnt/native/cpp/NTMechanism2D.cpp @@ -30,80 +30,15 @@ static void ConvertColor(std::string_view in, ImU32* out) { } } -namespace { - -class NTMechanismObjectModel; - -class NTMechanismGroupImpl final { - public: - NTMechanismGroupImpl(nt::NetworkTableInstance inst, std::string_view path, - std::string_view name) - : m_inst{inst}, m_path{path}, m_name{name} {} - - const char* GetName() const { return m_name.c_str(); } - void ForEachObject(wpi::function_ref func); - - void NTUpdate(const nt::Event& event, std::string_view name); - - protected: - nt::NetworkTableInstance m_inst; - std::string m_path; - std::string m_name; - std::vector> m_objects; -}; - -class NTMechanismObjectModel final : public MechanismObjectModel { - public: - NTMechanismObjectModel(nt::NetworkTableInstance inst, std::string_view path, - std::string_view name) - : m_group{inst, path, name}, - m_typeTopic{inst.GetTopic(fmt::format("{}/.type", path))}, - m_colorTopic{inst.GetTopic(fmt::format("{}/color", path))}, - m_weightTopic{inst.GetTopic(fmt::format("{}/weight", path))}, - m_angleTopic{inst.GetTopic(fmt::format("{}/angle", path))}, - m_lengthTopic{inst.GetTopic(fmt::format("{}/length", path))} {} - - const char* GetName() const final { return m_group.GetName(); } - void ForEachObject( - wpi::function_ref func) final { - m_group.ForEachObject(func); - } - - const char* GetType() const final { return m_typeValue.c_str(); } - ImU32 GetColor() const final { return m_colorValue; } - double GetWeight() const final { return m_weightValue; } - frc::Rotation2d GetAngle() const final { return m_angleValue; } - units::meter_t GetLength() const final { return m_lengthValue; } - - bool NTUpdate(const nt::Event& event, std::string_view name); - - private: - NTMechanismGroupImpl m_group; - - nt::Topic m_typeTopic; - nt::Topic m_colorTopic; - nt::Topic m_weightTopic; - nt::Topic m_angleTopic; - nt::Topic m_lengthTopic; - - std::string m_typeValue; - ImU32 m_colorValue = IM_COL32_WHITE; - double m_weightValue = 1.0; - frc::Rotation2d m_angleValue; - units::meter_t m_lengthValue = 0.0_m; -}; - -} // namespace - -void NTMechanismGroupImpl::ForEachObject( +void NTMechanism2DModel::NTMechanismGroupImpl::ForEachObject( wpi::function_ref func) { for (auto&& obj : m_objects) { func(*obj); } } -void NTMechanismGroupImpl::NTUpdate(const nt::Event& event, - std::string_view name) { +void NTMechanism2DModel::NTMechanismGroupImpl::NTUpdate(const nt::Event& event, + std::string_view name) { if (name.empty()) { return; } @@ -140,8 +75,8 @@ void NTMechanismGroupImpl::NTUpdate(const nt::Event& event, } } -bool NTMechanismObjectModel::NTUpdate(const nt::Event& event, - std::string_view childName) { +bool NTMechanism2DModel::NTMechanismObjectModel::NTUpdate( + const nt::Event& event, std::string_view childName) { if (auto info = event.GetTopicInfo()) { if (info->topic == m_typeTopic.GetHandle()) { if (event.flags & nt::EventFlags::kUnpublish) { @@ -181,31 +116,6 @@ bool NTMechanismObjectModel::NTUpdate(const nt::Event& event, return false; } -class NTMechanism2DModel::RootModel final : public MechanismRootModel { - public: - RootModel(nt::NetworkTableInstance inst, std::string_view path, - std::string_view name) - : m_group{inst, path, name}, - m_xTopic{inst.GetTopic(fmt::format("{}/x", path))}, - m_yTopic{inst.GetTopic(fmt::format("{}/y", path))} {} - - const char* GetName() const final { return m_group.GetName(); } - void ForEachObject( - wpi::function_ref func) final { - m_group.ForEachObject(func); - } - - bool NTUpdate(const nt::Event& event, std::string_view childName); - - frc::Translation2d GetPosition() const override { return m_pos; }; - - private: - NTMechanismGroupImpl m_group; - nt::Topic m_xTopic; - nt::Topic m_yTopic; - frc::Translation2d m_pos; -}; - bool NTMechanism2DModel::RootModel::NTUpdate(const nt::Event& event, std::string_view childName) { if (auto info = event.GetTopicInfo()) { diff --git a/glass/src/libnt/native/cpp/NetworkTables.cpp b/glass/src/libnt/native/cpp/NetworkTables.cpp index db75f5db12..8d3959f4b6 100644 --- a/glass/src/libnt/native/cpp/NetworkTables.cpp +++ b/glass/src/libnt/native/cpp/NetworkTables.cpp @@ -1448,7 +1448,7 @@ static void EmitEntryValueEditable(NetworkTablesModel* model, } case NT_INTEGER: { int64_t v = val.GetInteger(); - if (InputExpr(typeStr, &v, "%d", + if (InputExpr(typeStr, &v, "%" PRId64, ImGuiInputTextFlags_EnterReturnsTrue)) { if (entry.publisher == 0) { entry.publisher = nt::Publish(entry.info.topic, NT_INTEGER, "int"); diff --git a/glass/src/libnt/native/include/glass/networktables/NTMechanism2D.h b/glass/src/libnt/native/include/glass/networktables/NTMechanism2D.h index e8ffa9d7ee..a2709c7938 100644 --- a/glass/src/libnt/native/include/glass/networktables/NTMechanism2D.h +++ b/glass/src/libnt/native/include/glass/networktables/NTMechanism2D.h @@ -55,7 +55,92 @@ class NTMechanism2DModel : public Mechanism2DModel { frc::Translation2d m_dimensionsValue; ImU32 m_bgColorValue = 0; - class RootModel; + class NTMechanismObjectModel; + class NTMechanismGroupImpl final { + public: + NTMechanismGroupImpl(nt::NetworkTableInstance inst, std::string_view path, + std::string_view name) + : m_inst{inst}, m_path{path}, m_name{name} {} + + const char* GetName() const { return m_name.c_str(); } + void ForEachObject( + wpi::function_ref func); + + void NTUpdate(const nt::Event& event, std::string_view name); + + protected: + nt::NetworkTableInstance m_inst; + std::string m_path; + std::string m_name; + std::vector> m_objects; + }; + + class NTMechanismObjectModel final : public MechanismObjectModel { + public: + NTMechanismObjectModel(nt::NetworkTableInstance inst, std::string_view path, + std::string_view name) + : m_group{inst, path, name}, + m_typeTopic{inst.GetTopic(fmt::format("{}/.type", path))}, + m_colorTopic{inst.GetTopic(fmt::format("{}/color", path))}, + m_weightTopic{inst.GetTopic(fmt::format("{}/weight", path))}, + m_angleTopic{inst.GetTopic(fmt::format("{}/angle", path))}, + m_lengthTopic{inst.GetTopic(fmt::format("{}/length", path))} {} + + const char* GetName() const final { return m_group.GetName(); } + void ForEachObject( + wpi::function_ref func) final { + m_group.ForEachObject(func); + } + + const char* GetType() const final { return m_typeValue.c_str(); } + ImU32 GetColor() const final { return m_colorValue; } + double GetWeight() const final { return m_weightValue; } + frc::Rotation2d GetAngle() const final { return m_angleValue; } + units::meter_t GetLength() const final { return m_lengthValue; } + + bool NTUpdate(const nt::Event& event, std::string_view name); + + private: + NTMechanismGroupImpl m_group; + + nt::Topic m_typeTopic; + nt::Topic m_colorTopic; + nt::Topic m_weightTopic; + nt::Topic m_angleTopic; + nt::Topic m_lengthTopic; + + std::string m_typeValue; + ImU32 m_colorValue = IM_COL32_WHITE; + double m_weightValue = 1.0; + frc::Rotation2d m_angleValue; + units::meter_t m_lengthValue = 0.0_m; + }; + + class RootModel final : public MechanismRootModel { + public: + RootModel(nt::NetworkTableInstance inst, std::string_view path, + std::string_view name) + : m_group{inst, path, name}, + m_xTopic{inst.GetTopic(fmt::format("{}/x", path))}, + m_yTopic{inst.GetTopic(fmt::format("{}/y", path))} {} + + const char* GetName() const final { return m_group.GetName(); } + void ForEachObject( + wpi::function_ref func) final { + m_group.ForEachObject(func); + } + + bool NTUpdate(const nt::Event& event, std::string_view childName); + + frc::Translation2d GetPosition() const override { return m_pos; }; + + private: + NTMechanismGroupImpl m_group; + nt::Topic m_xTopic; + nt::Topic m_yTopic; + frc::Translation2d m_pos; + }; + std::vector> m_roots; }; diff --git a/ntcore/doc/networktables4.adoc b/ntcore/doc/networktables4.adoc index 318afac7f8..e41bbdc3e7 100644 --- a/ntcore/doc/networktables4.adoc +++ b/ntcore/doc/networktables4.adoc @@ -163,6 +163,11 @@ Clients may publish a value at any time following clock synchronization. Client Clients should subscribe to the `$sub$` meta topic for each topic published and use this metadata to determine how frequently to send updates to the network. However, this is not required--clients may choose to ignore this and send updates at any time. +[[ids]] +=== IDs and UIDs + +IDs and UIDs should be selected by clients and servers to be as small as possible for transmission efficiency. Clients and servers should support a signed 32-bit range for IDs and UIDs, but exceptions can be made for implementation reasons. Clients and servers must ignore messages with unsupported IDs and UIDs, and should report a diagnostic if this occurs. + [[meta-topics]] === Server-Published Meta Topics diff --git a/ntcore/src/main/native/cpp/net/WireDecoder.cpp b/ntcore/src/main/native/cpp/net/WireDecoder.cpp index 14a051d479..e588229aa6 100644 --- a/ntcore/src/main/native/cpp/net/WireDecoder.cpp +++ b/ntcore/src/main/native/cpp/net/WireDecoder.cpp @@ -174,6 +174,12 @@ static bool WireDecodeTextImpl(std::string_view in, T& out, goto err; } + // limit to 32-bit range and exclude endpoints used by DenseMap + if (pubuid >= 0x7fffffffLL || pubuid <= (-0x7fffffffLL - 1)) { + error = "pubuid out of range"; + goto err; + } + // properties; allow missing (treated as empty) wpi::json* properties = nullptr; auto propertiesIt = params->find("properties"); @@ -200,6 +206,12 @@ static bool WireDecodeTextImpl(std::string_view in, T& out, goto err; } + // limit to 32-bit range and exclude endpoints used by DenseMap + if (pubuid >= 0x7fffffffLL || pubuid <= (-0x7fffffffLL - 1)) { + error = "pubuid out of range"; + goto err; + } + // complete out.ClientUnpublish(pubuid); rv = true; @@ -231,6 +243,12 @@ static bool WireDecodeTextImpl(std::string_view in, T& out, goto err; } + // limit to 32-bit range and exclude endpoints used by DenseMap + if (subuid >= 0x7fffffffLL || subuid <= (-0x7fffffffLL - 1)) { + error = "subuid out of range"; + goto err; + } + // options PubSubOptionsImpl options; auto optionsIt = params->find("options"); @@ -303,6 +321,12 @@ static bool WireDecodeTextImpl(std::string_view in, T& out, goto err; } + // limit to 32-bit range and exclude endpoints used by DenseMap + if (subuid >= 0x7fffffffLL || subuid <= (-0x7fffffffLL - 1)) { + error = "pubuid out of range"; + goto err; + } + // complete out.ClientUnsubscribe(subuid); rv = true; @@ -324,6 +348,12 @@ static bool WireDecodeTextImpl(std::string_view in, T& out, goto err; } + // limit to 32-bit range and exclude endpoints used by DenseMap + if (id >= 0x7fffffffLL || id <= (-0x7fffffffLL - 1)) { + error = "id out of range"; + goto err; + } + // type auto typeStr = ObjGetString(*params, "type", &error); if (!typeStr) { @@ -339,6 +369,13 @@ static bool WireDecodeTextImpl(std::string_view in, T& out, error = "pubuid value must be a number"; goto err; } + + // limit to 32-bit range and exclude endpoints used by DenseMap + if (val >= 0x7fffffffLL || val <= (-0x7fffffffLL - 1)) { + error = "pubuid out of range"; + goto err; + } + pubuid = val; } @@ -369,6 +406,12 @@ static bool WireDecodeTextImpl(std::string_view in, T& out, goto err; } + // limit to 32-bit range and exclude endpoints used by DenseMap + if (id >= 0x7fffffffLL || id <= (-0x7fffffffLL - 1)) { + error = "id out of range"; + goto err; + } + // complete out.ServerUnannounce(*name, id); } else if (*method == PropertiesUpdateMsg::kMethodStr) { diff --git a/ntcore/src/test/native/cpp/server/ServerImplTest.cpp b/ntcore/src/test/native/cpp/server/ServerImplTest.cpp index 0db7f15d5b..2821e7c8f5 100644 --- a/ntcore/src/test/native/cpp/server/ServerImplTest.cpp +++ b/ntcore/src/test/native/cpp/server/ServerImplTest.cpp @@ -423,4 +423,20 @@ TEST_F(ServerImplTest, ZeroTimestampNegativeTime) { } } +TEST_F(ServerImplTest, InvalidPubUid) { + EXPECT_CALL(logger, Call(_, _, _, "0: pubuid out of range")); + server.SetLocal(&local, &queue); + + // connect client + ::testing::StrictMock wire; + MockSetPeriodicFunc setPeriodic; + auto [name, id] = server.AddClient("test", "connInfo", false, wire, + setPeriodic.AsStdFunction()); + + server.ProcessIncomingText( + id, + "[{\"method\":\"publish\",\"params\":{\"type\":\"string\",\"name\":" + "\"myvalue\",\"pubuid\":2147483647,\"properties\":{}}}]"); +} + } // namespace nt diff --git a/styleguide/checkstyle.xml b/styleguide/checkstyle.xml index 09e9f23dee..9ebe62c3c2 100644 --- a/styleguide/checkstyle.xml +++ b/styleguide/checkstyle.xml @@ -287,5 +287,6 @@ module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" + diff --git a/sysid/src/main/native/include/sysid/view/Analyzer.h b/sysid/src/main/native/include/sysid/view/Analyzer.h index 4b6e258341..b856510621 100644 --- a/sysid/src/main/native/include/sysid/view/Analyzer.h +++ b/sysid/src/main/native/include/sysid/view/Analyzer.h @@ -208,8 +208,6 @@ class Analyzer : public glass::View { std::string m_exception; std::vector m_missingTests; - bool m_calcDefaults = false; - // This is true if the error popup needs to be displayed bool m_errorPopup = false; @@ -235,12 +233,8 @@ class Analyzer : public glass::View { // Data analysis std::unique_ptr m_manager; int m_dataset = 0; - int m_window = 8; - double m_threshold = 0.2; float m_stepTestDuration = 0; - bool combinedGraphFit = false; - // Logger wpi::Logger& m_logger; diff --git a/thirdparty/imgui_suite/CMakeLists.txt b/thirdparty/imgui_suite/CMakeLists.txt index 4396843f54..e117f221fe 100644 --- a/thirdparty/imgui_suite/CMakeLists.txt +++ b/thirdparty/imgui_suite/CMakeLists.txt @@ -53,5 +53,9 @@ target_include_directories( target_compile_features(imgui PUBLIC cxx_std_20) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20.0) + target_compile_options(imgui PUBLIC -Wno-nontrivial-memcall) +endif() + install(TARGETS imgui EXPORT imgui) export(TARGETS imgui FILE imgui.cmake NAMESPACE imgui::) diff --git a/upstream_utils/memory.py b/upstream_utils/memory.py deleted file mode 100755 index 99ecb11a89..0000000000 --- a/upstream_utils/memory.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env python3 - -import os -import shutil -from pathlib import Path - -from upstream_utils import Lib, walk_cwd_and_copy_if - - -def run_source_replacements(memory_files: list[Path]): - for wpi_file in memory_files: - with open(wpi_file) as f: - content = f.read() - - # Fix #includes - content = content.replace('include "', 'include "wpi/memory/') - content = content.replace( - "wpi/memory/free_list_utils.hpp", "free_list_utils.hpp" - ) - - with open(wpi_file, "w") as f: - f.write(content) - - -def run_header_replacements(memory_files: list[Path]): - for wpi_file in memory_files: - if "detail" not in wpi_file.parts: - continue - with open(wpi_file) as f: - content = f.read() - - # Fix #includes - content = content.replace('include "config.hpp', 'include "../config.hpp') - - with open(wpi_file, "w") as f: - f.write(content) - - -def run_global_replacements(memory_files: list[Path]): - for wpi_file in memory_files: - with open(wpi_file) as f: - content = f.read() - - # Rename namespace from foonathan to wpi - content = content.replace("namespace foonathan", "namespace wpi") - content = content.replace("foonathan::", "wpi::") - content = content.replace("FOONATHAN_", "WPI_") - - # Fix #includes - content = content.replace('include "foonathan', 'include "wpi') - - with open(wpi_file, "w") as f: - f.write(content) - - -def copy_upstream_src(wpilib_root: Path): - upstream_root = Path(".").absolute() - wpiutil = wpilib_root / "wpiutil" - - # Delete old install - for d in [ - "src/main/native/thirdparty/memory/src", - "src/main/native/thirdparty/memory/include", - ]: - shutil.rmtree(wpiutil / d, ignore_errors=True) - - # Copy sources - os.chdir(upstream_root / "src") - src_files = walk_cwd_and_copy_if( - lambda dp, f: f.endswith(".cpp") or f.endswith(".hpp"), - wpiutil / "src/main/native/thirdparty/memory/src", - ) - run_global_replacements(src_files) - run_source_replacements(src_files) - - # Copy headers - os.chdir(upstream_root / "include/foonathan") - include_files = walk_cwd_and_copy_if( - lambda dp, f: f.endswith(".hpp"), - wpiutil / "src/main/native/thirdparty/memory/include/wpi", - ) - os.chdir(upstream_root) - run_global_replacements(include_files) - run_header_replacements(include_files) - - # Copy config_impl.hpp - shutil.copyfile( - wpilib_root / "upstream_utils/memory_files/config_impl.hpp", - wpiutil - / "src/main/native/thirdparty/memory/include/wpi/memory/config_impl.hpp", - ) - - -def main(): - name = "memory" - url = "https://github.com/foonathan/memory" - tag = "v0.7-3" - - memory = Lib(name, url, tag, copy_upstream_src) - memory.main() - - -if __name__ == "__main__": - main() diff --git a/upstream_utils/memory_files/config_impl.hpp b/upstream_utils/memory_files/config_impl.hpp deleted file mode 100644 index 1f72375524..0000000000 --- a/upstream_utils/memory_files/config_impl.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -// Copyright (C) 2015-2020 Jonathan Müller -// This file is subject to the license terms in the LICENSE file -// found in the top-level directory of this distribution. - -#pragma once - -#include - -//=== options ===// -#define WPI_MEMORY_CHECK_ALLOCATION_SIZE 1 -#define WPI_MEMORY_IMPL_DEFAULT_ALLOCATOR heap_allocator -#ifdef NDEBUG -#define WPI_MEMORY_DEBUG_ASSERT 0 -#define WPI_MEMORY_DEBUG_FILL 0 -#define WPI_MEMORY_DEBUG_FENCE 0 -#define WPI_MEMORY_DEBUG_LEAK_CHECK 0 -#define WPI_MEMORY_DEBUG_POINTER_CHECK 0 -#define WPI_MEMORY_DEBUG_DOUBLE_DEALLOC_CHECK 0 -#else -#define WPI_MEMORY_DEBUG_ASSERT 1 -#define WPI_MEMORY_DEBUG_FILL 1 -#define WPI_MEMORY_DEBUG_FENCE 8 -#define WPI_MEMORY_DEBUG_LEAK_CHECK 1 -#define WPI_MEMORY_DEBUG_POINTER_CHECK 1 -#define WPI_MEMORY_DEBUG_DOUBLE_DEALLOC_CHECK 1 -#endif -#define WPI_MEMORY_EXTERN_TEMPLATE 1 -#define WPI_MEMORY_TEMPORARY_STACK_MODE 2 - -#define WPI_MEMORY_NO_NODE_SIZE 1 diff --git a/upstream_utils/memory_patches/0001-Group-doxygen-into-memory-module.patch b/upstream_utils/memory_patches/0001-Group-doxygen-into-memory-module.patch deleted file mode 100644 index 4bc812ce99..0000000000 --- a/upstream_utils/memory_patches/0001-Group-doxygen-into-memory-module.patch +++ /dev/null @@ -1,1391 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ryan Blue -Date: Wed, 21 Aug 2024 20:50:15 -0400 -Subject: [PATCH 1/3] Group doxygen into memory module - ---- - .../foonathan/memory/aligned_allocator.hpp | 2 +- - .../foonathan/memory/allocator_storage.hpp | 22 ++++++++--------- - include/foonathan/memory/allocator_traits.hpp | 12 +++++----- - include/foonathan/memory/config.hpp | 24 +++++++++---------- - include/foonathan/memory/container.hpp | 6 ++--- - include/foonathan/memory/debugging.hpp | 20 ++++++++-------- - .../foonathan/memory/default_allocator.hpp | 2 +- - include/foonathan/memory/deleter.hpp | 12 +++++----- - include/foonathan/memory/error.hpp | 14 +++++------ - .../foonathan/memory/fallback_allocator.hpp | 2 +- - include/foonathan/memory/heap_allocator.hpp | 6 ++--- - .../foonathan/memory/iteration_allocator.hpp | 8 +++---- - include/foonathan/memory/joint_allocator.hpp | 20 ++++++++-------- - include/foonathan/memory/malloc_allocator.hpp | 2 +- - include/foonathan/memory/memory_arena.hpp | 18 +++++++------- - include/foonathan/memory/memory_pool.hpp | 6 ++--- - .../memory/memory_pool_collection.hpp | 12 +++++----- - include/foonathan/memory/memory_pool_type.hpp | 6 ++--- - .../memory/memory_resource_adapter.hpp | 8 +++---- - include/foonathan/memory/memory_stack.hpp | 8 +++---- - include/foonathan/memory/namespace_alias.hpp | 15 ++++++++---- - include/foonathan/memory/new_allocator.hpp | 2 +- - include/foonathan/memory/segregator.hpp | 8 +++---- - include/foonathan/memory/smart_ptr.hpp | 14 +++++------ - include/foonathan/memory/static_allocator.hpp | 6 ++--- - include/foonathan/memory/std_allocator.hpp | 6 ++--- - .../foonathan/memory/temporary_allocator.hpp | 6 ++--- - include/foonathan/memory/threading.hpp | 4 ++-- - include/foonathan/memory/tracking.hpp | 8 +++---- - include/foonathan/memory/virtual_memory.hpp | 16 ++++++------- - 30 files changed, 150 insertions(+), 145 deletions(-) - -diff --git a/include/foonathan/memory/aligned_allocator.hpp b/include/foonathan/memory/aligned_allocator.hpp -index fe724aa9c7ce11c6b3078605728ec1ea3d07c1fe..5ca3f29b20575a36ef11327bb1219cb4013fc5e4 100644 ---- a/include/foonathan/memory/aligned_allocator.hpp -+++ b/include/foonathan/memory/aligned_allocator.hpp -@@ -20,7 +20,7 @@ namespace foonathan - { - /// A \concept{concept_rawallocator,RawAllocator} adapter that ensures a minimum alignment. - /// It adjusts the alignment value so that it is always larger than the minimum and forwards to the specified allocator. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class aligned_allocator : FOONATHAN_EBO(allocator_traits::allocator_type) - { -diff --git a/include/foonathan/memory/allocator_storage.hpp b/include/foonathan/memory/allocator_storage.hpp -index 57f128ab0a79ea53b5bd7bd11d72de7c97dcfd4c..11747a5b15c500243764094dba3163cc9e014390 100644 ---- a/include/foonathan/memory/allocator_storage.hpp -+++ b/include/foonathan/memory/allocator_storage.hpp -@@ -88,7 +88,7 @@ namespace foonathan - /// A \concept{concept_rawallocator,RawAllocator} that stores another allocator. - /// The \concept{concept_storagepolicy,StoragePolicy} defines the allocator type being stored and how it is stored. - /// The \c Mutex controls synchronization of the access. -- /// \ingroup storage -+ /// \ingroup memory_storage - template - class allocator_storage - : FOONATHAN_EBO(StoragePolicy, -@@ -317,14 +317,14 @@ namespace foonathan - - /// Tag type that enables type-erasure in \ref reference_storage. - /// It can be used everywhere a \ref allocator_reference is used internally. -- /// \ingroup storage -+ /// \ingroup memory_storage - struct any_allocator - { - }; - - /// A \concept{concept_storagepolicy,StoragePolicy} that stores the allocator directly. - /// It embeds the allocator inside it, i.e. moving the storage policy will move the allocator. -- /// \ingroup storage -+ /// \ingroup memory_storage - template - class direct_storage : FOONATHAN_EBO(allocator_traits::allocator_type) - { -@@ -381,7 +381,7 @@ namespace foonathan - /// An alias template for \ref allocator_storage using the \ref direct_storage policy without a mutex. - /// It has the effect of giving any \concept{concept_rawallocator,RawAllocator} the interface with all member functions, - /// avoiding the need to wrap it inside the \ref allocator_traits. -- /// \ingroup storage -+ /// \ingroup memory_storage - template - FOONATHAN_ALIAS_TEMPLATE(allocator_adapter, - allocator_storage, no_mutex>); -@@ -399,7 +399,7 @@ namespace foonathan - /// It has a similar effect as \ref allocator_adapter but performs synchronization. - /// The \c Mutex will default to \c std::mutex if threading is supported, - /// otherwise there is no default. --/// \ingroup storage -+/// \ingroup memory_storage - #if FOONATHAN_HOSTED_IMPLEMENTATION - template - FOONATHAN_ALIAS_TEMPLATE(thread_safe_allocator, -@@ -528,7 +528,7 @@ namespace foonathan - /// Specialize it for your own types, if they provide sharing semantics and can be copied. - /// They also must provide an `operator==` to check whether two allocators refer to the same shared one. - /// \note This makes no guarantees about the lifetime of the shared object, the sharing allocators can either own or refer to a shared object. -- /// \ingroup storage -+ /// \ingroup memory_storage - template - struct is_shared_allocator : std::false_type - { -@@ -540,7 +540,7 @@ namespace foonathan - /// For allocators that are already shared (determined through \ref is_shared_allocator) it will store the allocator type directly. - /// \note It does not take ownership over the allocator in the stateful case, the user has to ensure that the allocator object stays valid. - /// In the other cases the lifetime does not matter. -- /// \ingroup storage -+ /// \ingroup memory_storage - template - class reference_storage - #ifndef DOXYGEN -@@ -611,7 +611,7 @@ namespace foonathan - /// Specialization of the class template \ref reference_storage that is type-erased. - /// It is triggered by the tag type \ref any_allocator. - /// The specialization can store a reference to any allocator type. -- /// \ingroup storage -+ /// \ingroup memory_storage - template <> - class reference_storage - { -@@ -894,7 +894,7 @@ namespace foonathan - /// An alias template for \ref allocator_storage using the \ref reference_storage policy. - /// It will store a reference to the given allocator type. The tag type \ref any_allocator enables type-erasure. - /// Wrap the allocator in a \ref thread_safe_allocator if you want thread safety. -- /// \ingroup storage -+ /// \ingroup memory_storage - template - FOONATHAN_ALIAS_TEMPLATE(allocator_reference, - allocator_storage, no_mutex>); -@@ -909,14 +909,14 @@ namespace foonathan - } - - /// An alias for the \ref reference_storage specialization using type-erasure. -- /// \ingroup storage -+ /// \ingroup memory_storage - using any_reference_storage = reference_storage; - - /// An alias for \ref allocator_storage using the \ref any_reference_storage. - /// It will store a reference to any \concept{concept_rawallocator,RawAllocator}. - /// This is the same as passing the tag type \ref any_allocator to the alias \ref allocator_reference. - /// Wrap the allocator in a \ref thread_safe_allocator if you want thread safety. -- /// \ingroup storage -+ /// \ingroup memory_storage - using any_allocator_reference = allocator_storage; - - /// \returns A new \ref any_allocator_reference object by forwarding the allocator to the constructor. -diff --git a/include/foonathan/memory/allocator_traits.hpp b/include/foonathan/memory/allocator_traits.hpp -index 78f5ccf0669ae5a1fdc1ee0a868291a68b97ccd9..03b7ecdebc3511a07a1305b3101f28a6e304abc3 100644 ---- a/include/foonathan/memory/allocator_traits.hpp -+++ b/include/foonathan/memory/allocator_traits.hpp -@@ -54,7 +54,7 @@ namespace foonathan - /// It checks the existence of a custom \c construct(), \c destroy() function, if provided, - /// it cannot be used since it would not be called.
- /// Specialize it for custom \c Allocator types to override this check. -- /// \ingroup core -+ /// \ingroup memory_core - template - struct allocator_is_raw_allocator - : FOONATHAN_EBO(detail::check_standard_allocator::valid) -@@ -62,7 +62,7 @@ namespace foonathan - }; - - /// Specialization of \ref allocator_is_raw_allocator that allows \c std::allocator again. -- /// \ingroup core -+ /// \ingroup memory_core - template - struct allocator_is_raw_allocator> : std::true_type - { -@@ -286,7 +286,7 @@ namespace foonathan - /// The default specialization of the allocator_traits for a \concept{concept_rawallocator,RawAllocator}. - /// See the last link for the requirements on types that do not specialize this class and the interface documentation. - /// Any specialization must provide the same interface. -- /// \ingroup core -+ /// \ingroup memory_core - template - class allocator_traits - { -@@ -410,7 +410,7 @@ namespace foonathan - - /// Traits that check whether a type models concept \concept{concept_rawallocator,RawAllocator}.
- /// It must either provide the necessary functions for the default traits specialization or has specialized it. -- /// \ingroup core -+ /// \ingroup memory_core - template - struct is_raw_allocator - : detail::is_raw_allocator - class composable_allocator_traits - { -@@ -588,7 +588,7 @@ namespace foonathan - - /// Traits that check whether a type models concept \concept{concept_rawallocator,ComposableAllocator}.
- /// It must be a \concept{concept_rawallocator,RawAllocator} and either provide the necessary functions for the default traits specialization or has specialized it. -- /// \ingroup core -+ /// \ingroup memory_core - template - struct is_composable_allocator - : detail::is_composable_allocatorfoonathan::memory. - /// If \c false, a namespace alias namespace memory = foonathan::memory is automatically inserted into each header, - /// allowing to qualify everything with foonathan::. - /// \note This option breaks in combination with using using namespace foonathan;. --/// \ingroup core -+/// \ingroup memory_core - #define FOONATHAN_MEMORY_NAMESPACE_PREFIX 1 - - /// The mode of the automatic \ref foonathan::memory::temporary_stack creation. -@@ -140,7 +140,7 @@ - /// requires managing it through the \ref foonathan::memory::temporary_stack_initializer. - /// Set to `0` to disable the per-thread stack completely. - /// \ref foonathan::memory::get_temporary_stack() will abort the program upon call. --/// \ingroup allocator -+/// \ingroup memory_allocator - #define FOONATHAN_MEMORY_TEMPORARY_STACK_MODE 2 - #endif - -diff --git a/include/foonathan/memory/container.hpp b/include/foonathan/memory/container.hpp -index 5c77ddb4bd6a377dbcced4de781a772a7a2e6ff4..c954ca5deece3f4430fb934642b60e2e4550deff 100644 ---- a/include/foonathan/memory/container.hpp -+++ b/include/foonathan/memory/container.hpp -@@ -36,7 +36,7 @@ namespace foonathan - { - namespace memory - { -- /// \ingroup adapter -+ /// \ingroup memory_adapter - /// @{ - - /// Alias template for an STL container that uses a certain -@@ -213,7 +213,7 @@ namespace foonathan - /// @{ - /// Convenience function to create a container adapter using a certain - /// \concept{concept_rawallocator,RawAllocator}. \returns An empty adapter with an -- /// implementation container using a reference to a given allocator. \ingroup adapter -+ /// implementation container using a reference to a given allocator. \ingroup memory_adapter - template > - std::stack make_stack(RawAllocator& allocator) - { -@@ -271,7 +271,7 @@ namespace foonathan - #endif - - #else -- /// \ingroup adapter -+ /// \ingroup memory_adapter - /// @{ - - /// Contains the node size of a node based STL container with a specific type. -diff --git a/include/foonathan/memory/debugging.hpp b/include/foonathan/memory/debugging.hpp -index bb9af985ea32f3c6a2d55eb41d19eb7e9ae418e2..20f5e0a9625e25dbd704634a5b34034f88106117 100644 ---- a/include/foonathan/memory/debugging.hpp -+++ b/include/foonathan/memory/debugging.hpp -@@ -18,7 +18,7 @@ namespace foonathan - /// The magic values that are used for debug filling. - /// If \ref FOONATHAN_MEMORY_DEBUG_FILL is \c true, memory will be filled to help detect use-after-free or missing initialization errors. - /// These are the constants for the different types. -- /// \ingroup core -+ /// \ingroup memory_core - enum class debug_magic : unsigned char - { - /// Marks internal memory used by the allocator - "allocated block". -@@ -47,19 +47,19 @@ namespace foonathan - /// It must not throw any exceptions since it is called in the cleanup process. - /// \defaultbe On a hosted implementation it logs the leak to \c stderr and returns, continuing execution. - /// On a freestanding implementation it does nothing. -- /// \ingroup core -+ /// \ingroup memory_core - using leak_handler = void (*)(const allocator_info& info, std::ptrdiff_t amount); - - /// Exchanges the \ref leak_handler. - /// \effects Sets \c h as the new \ref leak_handler in an atomic operation. - /// A \c nullptr sets the default \ref leak_handler. - /// \returns The previous \ref leak_handler. This is never \c nullptr. -- /// \ingroup core -+ /// \ingroup memory_core - leak_handler set_leak_handler(leak_handler h); - - /// Returns the \ref leak_handler. - /// \returns The current \ref leak_handler. This is never \c nullptr. -- /// \ingroup core -+ /// \ingroup memory_core - leak_handler get_leak_handler(); - - /// The type of the handler called when an invalid pointer is passed to a deallocation function. -@@ -69,19 +69,19 @@ namespace foonathan - /// It must not throw any exceptions since it might be called in the cleanup process. - /// \defaultbe On a hosted implementation it logs the information to \c stderr and calls \c std::abort(). - /// On a freestanding implementation it only calls \c std::abort(). -- /// \ingroup core -+ /// \ingroup memory_core - using invalid_pointer_handler = void (*)(const allocator_info& info, const void* ptr); - - /// Exchanges the \ref invalid_pointer_handler. - /// \effects Sets \c h as the new \ref invalid_pointer_handler in an atomic operation. - /// A \c nullptr sets the default \ref invalid_pointer_handler. - /// \returns The previous \ref invalid_pointer_handler. This is never \c nullptr. -- /// \ingroup core -+ /// \ingroup memory_core - invalid_pointer_handler set_invalid_pointer_handler(invalid_pointer_handler h); - - /// Returns the \ref invalid_pointer_handler. - /// \returns The current \ref invalid_pointer_handler. This is never \c nullptr. -- /// \ingroup core -+ /// \ingroup memory_core - invalid_pointer_handler get_invalid_pointer_handler(); - - /// The type of the handler called when a buffer under/overflow is detected. -@@ -92,7 +92,7 @@ namespace foonathan - /// It must not throw any exceptions since it me be called in the cleanup process. - /// \defaultbe On a hosted implementation it logs the information to \c stderr and calls \c std::abort(). - /// On a freestanding implementation it only calls \c std::abort(). -- /// \ingroup core -+ /// \ingroup memory_core - using buffer_overflow_handler = void (*)(const void* memory, std::size_t size, - const void* write_ptr); - -@@ -100,12 +100,12 @@ namespace foonathan - /// \effects Sets \c h as the new \ref buffer_overflow_handler in an atomic operation. - /// A \c nullptr sets the default \ref buffer_overflow_handler. - /// \returns The previous \ref buffer_overflow_handler. This is never \c nullptr. -- /// \ingroup core -+ /// \ingroup memory_core - buffer_overflow_handler set_buffer_overflow_handler(buffer_overflow_handler h); - - /// Returns the \ref buffer_overflow_handler. - /// \returns The current \ref buffer_overflow_handler. This is never \c nullptr. -- /// \ingroup core -+ /// \ingroup memory_core - buffer_overflow_handler get_buffer_overflow_handler(); - } // namespace memory - } // namespace foonathan -diff --git a/include/foonathan/memory/default_allocator.hpp b/include/foonathan/memory/default_allocator.hpp -index 29a2139439966d7b65c2bcb45b91c0a37a4b6cec..8466bc3a6ecac6cc1ef7c95cb78206b2e56dbf57 100644 ---- a/include/foonathan/memory/default_allocator.hpp -+++ b/include/foonathan/memory/default_allocator.hpp -@@ -28,7 +28,7 @@ namespace foonathan - /// \requiredbe Its type can be changed via the CMake option \c FOONATHAN_MEMORY_DEFAULT_ALLCOATOR, - /// but it must be one of the following: \ref heap_allocator, \ref new_allocator, \ref malloc_allocator, \ref static_allocator, \ref virtual_memory_allocator. - /// \defaultbe The default is \ref heap_allocator. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - using default_allocator = FOONATHAN_IMPL_DEFINED(FOONATHAN_MEMORY_IMPL_DEFAULT_ALLOCATOR); - } // namespace memory - } // namespace foonathan -diff --git a/include/foonathan/memory/deleter.hpp b/include/foonathan/memory/deleter.hpp -index 6c9cf5fb96401f9bdea930fe4cfc1deae83db205..fe3ce220dc751ed86b2f4822693f4524f53d47d1 100644 ---- a/include/foonathan/memory/deleter.hpp -+++ b/include/foonathan/memory/deleter.hpp -@@ -20,7 +20,7 @@ namespace foonathan - /// A deleter class that deallocates the memory through a specified \concept{concept_rawallocator,RawAllocator}. - /// - /// It deallocates memory for a specified type but does not call its destructors. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class allocator_deallocator : FOONATHAN_EBO(allocator_reference) - { -@@ -63,7 +63,7 @@ namespace foonathan - - /// Specialization of \ref allocator_deallocator for array types. - /// Otherwise the same behavior. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class allocator_deallocator - : FOONATHAN_EBO(allocator_reference) -@@ -119,7 +119,7 @@ namespace foonathan - /// A deleter class that deallocates the memory of a derived type through a specified \concept{concept_rawallocator,RawAllocator}. - /// - /// It can only be created from a \ref allocator_deallocator and thus must only be used for smart pointers initialized by derived-to-base conversion of the pointer. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class allocator_polymorphic_deallocator : FOONATHAN_EBO(allocator_reference) - { -@@ -159,7 +159,7 @@ namespace foonathan - - /// Similar to \ref allocator_deallocator but calls the destructors of the object. - /// Otherwise behaves the same. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class allocator_deleter : FOONATHAN_EBO(allocator_reference) - { -@@ -203,7 +203,7 @@ namespace foonathan - - /// Specialization of \ref allocator_deleter for array types. - /// Otherwise the same behavior. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class allocator_deleter - : FOONATHAN_EBO(allocator_reference) -@@ -260,7 +260,7 @@ namespace foonathan - /// Similar to \ref allocator_polymorphic_deallocator but calls the destructors of the object. - /// Otherwise behaves the same. - /// \note It has a relatively high space overhead, so only use it if you have to. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class allocator_polymorphic_deleter : FOONATHAN_EBO(allocator_reference) - { -diff --git a/include/foonathan/memory/error.hpp b/include/foonathan/memory/error.hpp -index d3152dc7aea8f2e1e48e652f1510fa02b10634f0..df6fa8ee4ee8f2576d5ee9c52e5677b3ac4cd59b 100644 ---- a/include/foonathan/memory/error.hpp -+++ b/include/foonathan/memory/error.hpp -@@ -18,7 +18,7 @@ namespace foonathan - { - /// Contains information about an allocator. - /// It can be used for logging in the various handler functions. -- /// \ingroup core -+ /// \ingroup memory_core - struct allocator_info - { - /// The name of the allocator. -@@ -60,7 +60,7 @@ namespace foonathan - /// It is derived from \c std::bad_alloc. - /// This can happen if a low level allocation function like \c std::malloc() runs out of memory. - /// Throwing can be prohibited by the handler function. -- /// \ingroup core -+ /// \ingroup memory_core - class out_of_memory : public std::bad_alloc - { - public: -@@ -116,7 +116,7 @@ namespace foonathan - /// thrown when a low-level allocator with a fixed size runs out of memory. - /// For example, thrown by \ref fixed_block_allocator or \ref static_allocator.
- /// It is derived from \ref out_of_memory but does not provide its own handler. -- /// \ingroup core -+ /// \ingroup memory_core - class out_of_fixed_memory : public out_of_memory - { - public: -@@ -142,7 +142,7 @@ namespace foonathan - /// since it always depends on fence memory, alignment buffer and the like. - /// \note A user should only \c catch for \c bad_allocation_size, not the derived classes. - /// \note Most checks will only be done if \ref FOONATHAN_MEMORY_CHECK_ALLOCATION_SIZE is \c true. -- /// \ingroup core -+ /// \ingroup memory_core - class bad_allocation_size : public std::bad_alloc - { - public: -@@ -206,7 +206,7 @@ namespace foonathan - /// The exception class thrown when the node size exceeds the supported maximum, - /// i.e. it is bigger than \c max_node_size(). - /// It is derived from \ref bad_allocation_size but does not override the handler. -- /// \ingroup core -+ /// \ingroup memory_core - class bad_node_size : public bad_allocation_size - { - public: -@@ -224,7 +224,7 @@ namespace foonathan - /// The exception class thrown when the array size exceeds the supported maximum, - /// i.e. it is bigger than \c max_array_size(). - /// It is derived from \ref bad_allocation_size but does not override the handler. -- /// \ingroup core -+ /// \ingroup memory_core - class bad_array_size : public bad_allocation_size - { - public: -@@ -242,7 +242,7 @@ namespace foonathan - /// The exception class thrown when the alignment exceeds the supported maximum, - /// i.e. it is bigger than \c max_alignment(). - /// It is derived from \ref bad_allocation_size but does not override the handler. -- /// \ingroup core -+ /// \ingroup memory_core - class bad_alignment : public bad_allocation_size - { - public: -diff --git a/include/foonathan/memory/fallback_allocator.hpp b/include/foonathan/memory/fallback_allocator.hpp -index 7ae86eaa79b9f1d85002de767e27d9f75eee3343..b4157062d42060be4fe649fe1e84af5aec0567cf 100644 ---- a/include/foonathan/memory/fallback_allocator.hpp -+++ b/include/foonathan/memory/fallback_allocator.hpp -@@ -21,7 +21,7 @@ namespace foonathan - /// it uses `Fallback`. - /// \requires `Default` must be a composable \concept{concept_rawallocator,RawAllocator}, - /// `Fallback` must be a \concept{concept_rawallocator,RawAllocator}. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class fallback_allocator - : FOONATHAN_EBO(detail::ebo_storage<0, typename allocator_traits::allocator_type>), -diff --git a/include/foonathan/memory/heap_allocator.hpp b/include/foonathan/memory/heap_allocator.hpp -index 87532c45c8f608042a7c7536eb4ff8d0e0ae6d08..ed8f2fb9af2d593fde141b3bdb8b17e8074f8c9c 100644 ---- a/include/foonathan/memory/heap_allocator.hpp -+++ b/include/foonathan/memory/heap_allocator.hpp -@@ -28,7 +28,7 @@ namespace foonathan - /// It shall return a \c nullptr if no memory is available. - /// It must be thread safe. - /// \defaultbe On a hosted implementation this function uses OS specific facilities, \c std::malloc is used as fallback. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - void* heap_alloc(std::size_t size) noexcept; - - /// Deallocates heap memory. -@@ -39,7 +39,7 @@ namespace foonathan - /// The pointer will not be zero. - /// It must be thread safe. - /// \defaultbe On a hosted implementation this function uses OS specific facilities, \c std::free is used as fallback. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - void heap_dealloc(void* ptr, std::size_t size) noexcept; - - namespace detail -@@ -68,7 +68,7 @@ namespace foonathan - /// A stateless \concept{concept_rawallocator,RawAllocator} that allocates memory from the heap. - /// It uses the two functions \ref heap_alloc and \ref heap_dealloc for the allocation, - /// which default to \c std::malloc and \c std::free. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - using heap_allocator = - FOONATHAN_IMPL_DEFINED(detail::lowlevel_allocator); - -diff --git a/include/foonathan/memory/iteration_allocator.hpp b/include/foonathan/memory/iteration_allocator.hpp -index 37cb4cc3531ad70a024c30c0457273ff42d37e3d..fdfcfa0f80d9fe5b4ea6fbec06420697f20b77b4 100644 ---- a/include/foonathan/memory/iteration_allocator.hpp -+++ b/include/foonathan/memory/iteration_allocator.hpp -@@ -32,7 +32,7 @@ namespace foonathan - /// effectively releasing all of its memory. - /// Any memory allocated will thus be usable for `N` iterations of the loop. - /// This type of allocator is a generalization of the double frame allocator. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class iteration_allocator - : FOONATHAN_EBO(detail::iteration_block_allocator) -@@ -187,7 +187,7 @@ namespace foonathan - }; - - /// An alias for \ref iteration_allocator for two iterations. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - FOONATHAN_ALIAS_TEMPLATE(double_frame_allocator, - iteration_allocator<2, BlockOrRawAllocator>); -@@ -199,7 +199,7 @@ namespace foonathan - /// Specialization of the \ref allocator_traits for \ref iteration_allocator. - /// \note It is not allowed to mix calls through the specialization and through the member functions, - /// i.e. \ref memory_stack::allocate() and this \c allocate_node(). -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class allocator_traits> - { -@@ -256,7 +256,7 @@ namespace foonathan - }; - - /// Specialization of the \ref composable_allocator_traits for \ref iteration_allocator classes. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class composable_allocator_traits> - { -diff --git a/include/foonathan/memory/joint_allocator.hpp b/include/foonathan/memory/joint_allocator.hpp -index 377bc81c20c532ff268360284672a4103594ed29..894ac381e82950637783ebe9f7100a95d3240da3 100644 ---- a/include/foonathan/memory/joint_allocator.hpp -+++ b/include/foonathan/memory/joint_allocator.hpp -@@ -97,7 +97,7 @@ namespace foonathan - /// Tag type that can't be created. - /// - /// It isued by \ref joint_ptr. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - class joint - { - joint(std::size_t cap) noexcept : capacity(cap) {} -@@ -113,7 +113,7 @@ namespace foonathan - /// Tag type to make the joint size more explicit. - /// - /// It is used by \ref joint_ptr. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - struct joint_size - { - std::size_t size; -@@ -125,7 +125,7 @@ namespace foonathan - /// - /// This will disable default copy/move operations - /// and inserts additional members for the joint memory management. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class joint_type - { -@@ -207,7 +207,7 @@ namespace foonathan - /// - /// The memory block will be managed by the given \concept{concept_rawallocator,RawAllocator}, - /// it is stored in an \ref allocator_reference and not owned by the pointer directly. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class joint_ptr : FOONATHAN_EBO(allocator_reference) - { -@@ -450,7 +450,7 @@ namespace foonathan - /// @{ - /// \returns A new \ref joint_ptr as if created with the same arguments passed to the constructor. - /// \relatesalso joint_ptr -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - auto allocate_joint(RawAllocator& alloc, joint_size additional_size, Args&&... args) - -> joint_ptr -@@ -471,7 +471,7 @@ namespace foonathan - /// @{ - /// \returns A new \ref joint_ptr that points to a copy of `joint`. - /// It will allocate as much memory as needed and forward to the copy constructor. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - auto clone_joint(RawAllocator& alloc, const joint_type& joint) - -> joint_ptr -@@ -498,7 +498,7 @@ namespace foonathan - /// It is somewhat limited and allows only allocation once. - /// All joint allocators for an object share the joint memory and must not be used in multiple threads. - /// The memory it returns is owned by a \ref joint_ptr and will be destroyed through it. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - class joint_allocator - { - public: -@@ -567,7 +567,7 @@ namespace foonathan - - /// Specialization of \ref is_shared_allocator to mark \ref joint_allocator as shared. - /// This allows using it as \ref allocator_reference directly. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template <> - struct is_shared_allocator : std::true_type - { -@@ -594,7 +594,7 @@ namespace foonathan - /// \note This is required because the container constructor will end up copying/moving the allocator. - /// But this is not allowed as you need the allocator with the correct joined memory. - /// Copying can be customized (i.e. forbidden), but sadly not move, so keep that in mind. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template <> - struct propagation_traits - { -@@ -624,7 +624,7 @@ namespace foonathan - /// - /// It has a dynamic, but fixed size, - /// it cannot grow after it has been created. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class joint_array - { -diff --git a/include/foonathan/memory/malloc_allocator.hpp b/include/foonathan/memory/malloc_allocator.hpp -index ef8a1b03fe5f767298024aa680722648caa48b82..cc3700cfe2f2339aca2808a745ae1d02b3f11ffb 100644 ---- a/include/foonathan/memory/malloc_allocator.hpp -+++ b/include/foonathan/memory/malloc_allocator.hpp -@@ -56,7 +56,7 @@ namespace foonathan - - /// A stateless \concept{concept_rawallocator,RawAllocator} that allocates memory using std::malloc(). - /// It throws \ref out_of_memory when the allocation fails. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - using malloc_allocator = - FOONATHAN_IMPL_DEFINED(detail::lowlevel_allocator); - -diff --git a/include/foonathan/memory/memory_arena.hpp b/include/foonathan/memory/memory_arena.hpp -index 4c277d816abd550d165e5df40161e313e543fd36..645796bece4f81fd7c84c6c039b1ee619499daff 100644 ---- a/include/foonathan/memory/memory_arena.hpp -+++ b/include/foonathan/memory/memory_arena.hpp -@@ -23,7 +23,7 @@ namespace foonathan - { - /// A memory block. - /// It is defined by its starting address and size. -- /// \ingroup core -+ /// \ingroup memory_core - struct memory_block - { - void* memory; ///< The address of the memory block (might be \c nullptr). -@@ -67,7 +67,7 @@ namespace foonathan - } // namespace detail - - /// Traits that check whether a type models concept \concept{concept_blockallocator,BlockAllocator}. -- /// \ingroup core -+ /// \ingroup memory_core - template - struct is_block_allocator : decltype(detail::is_block_allocator_impl(0)) - { -@@ -85,7 +85,7 @@ namespace foonathan - /// This can be useful, e.g. if there will never be blocks available for deallocation. - /// The (tiny) overhead for the cache can then be disabled. - /// An example is \ref memory_pool. -- /// \ingroup core -+ /// \ingroup memory_core - constexpr bool cached_arena = true; - constexpr bool uncached_arena = false; - /// @} -@@ -271,7 +271,7 @@ namespace foonathan - /// This can be disabled with the second template parameter, - /// passing it \ref uncached_arena (or \c false) disables it, - /// \ref cached_arena (or \c true) enables it explicitly. -- /// \ingroup core -+ /// \ingroup memory_core - template - class memory_arena : FOONATHAN_EBO(BlockAllocator), - FOONATHAN_EBO(detail::memory_arena_cache) -@@ -443,7 +443,7 @@ namespace foonathan - /// The size of the next memory block will grow by a given factor after each allocation, - /// allowing an amortized constant allocation time in the higher level allocator. - /// The factor can be given as rational in the template parameter, default is \c 2. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class growing_block_allocator - : FOONATHAN_EBO(allocator_traits::allocator_type) -@@ -522,7 +522,7 @@ namespace foonathan - /// A \concept{concept_blockallocator,BlockAllocator} that allows only one block allocation. - /// It can be used to prevent higher-level allocators from expanding. - /// The one block allocation is performed through the \c allocate_array() function of the given \concept{concept_rawallocator,RawAllocator}. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class fixed_block_allocator : FOONATHAN_EBO(allocator_traits::allocator_type) - { -@@ -616,7 +616,7 @@ namespace foonathan - /// Takes either a \concept{concept_blockallocator,BlockAllocator} or a \concept{concept_rawallocator,RawAllocator}. - /// In the first case simply aliases the type unchanged, in the second to \ref growing_block_allocator (or the template in `BlockAllocator`) with the \concept{concept_rawallocator,RawAllocator}. - /// Using this allows passing normal \concept{concept_rawallocator,RawAllocators} as \concept{concept_blockallocator,BlockAllocators}. -- /// \ingroup core -+ /// \ingroup memory_core - template class BlockAllocator = detail::default_block_wrapper> - using make_block_allocator_t = FOONATHAN_IMPL_DEFINED( -@@ -628,7 +628,7 @@ namespace foonathan - /// Helper function make a \concept{concept_blockallocator,BlockAllocator}. - /// \returns A \concept{concept_blockallocator,BlockAllocator} of the given type created with the given arguments. - /// \requires Same requirements as the constructor. -- /// \ingroup core -+ /// \ingroup memory_core - template - make_block_allocator_t make_block_allocator(std::size_t block_size, - Args&&... args) -@@ -654,7 +654,7 @@ namespace foonathan - { - /// Syntax sugar to express sizes with unit prefixes. - /// \returns The number of bytes `value` is in the given unit. -- /// \ingroup core -+ /// \ingroup memory_core - /// @{ - constexpr std::size_t operator"" _KiB(unsigned long long value) noexcept - { -diff --git a/include/foonathan/memory/memory_pool.hpp b/include/foonathan/memory/memory_pool.hpp -index d764365b22a498cfad37522e63c84b02f639800a..7e833a6e55ee3fb4315b693303a9252a494426f1 100644 ---- a/include/foonathan/memory/memory_pool.hpp -+++ b/include/foonathan/memory/memory_pool.hpp -@@ -42,7 +42,7 @@ namespace foonathan - /// for example in a node based container like \c std::list. - /// It is not so good for different allocation sizes and has some drawbacks for arrays - /// as described in \ref memory_pool_type.hpp. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class memory_pool - : FOONATHAN_EBO(detail::default_leak_checker) -@@ -280,7 +280,7 @@ namespace foonathan - /// Specialization of the \ref allocator_traits for \ref memory_pool classes. - /// \note It is not allowed to mix calls through the specialization and through the member functions, - /// i.e. \ref memory_pool::allocate_node() and this \c allocate_node(). -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class allocator_traits> - { -@@ -360,7 +360,7 @@ namespace foonathan - }; - - /// Specialization of the \ref composable_allocator_traits for \ref memory_pool classes. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class composable_allocator_traits> - { -diff --git a/include/foonathan/memory/memory_pool_collection.hpp b/include/foonathan/memory/memory_pool_collection.hpp -index e6952e9d8b5a10ff9ecc1d01ddf322683acefe25..5467efe6c865a49563aa877d417641e6b1c840e9 100644 ---- a/include/foonathan/memory/memory_pool_collection.hpp -+++ b/include/foonathan/memory/memory_pool_collection.hpp -@@ -34,7 +34,7 @@ namespace foonathan - /// A \c BucketDistribution for \ref memory_pool_collection defining that there is a bucket, i.e. pool, for each size. - /// That means that for each possible size up to an upper bound there will be a seperate free list. - /// Allocating a node will not waste any memory. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - struct identity_buckets - { - using type = detail::identity_access_policy; -@@ -43,7 +43,7 @@ namespace foonathan - /// A \c BucketDistribution for \ref memory_pool_collection defining that there is a bucket, i.e. pool, for each power of two. - /// That means for each power of two up to an upper bound there will be a separate free list. - /// Allocating a node will only waste half of the memory. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - struct log2_buckets - { - using type = detail::log2_access_policy; -@@ -55,7 +55,7 @@ namespace foonathan - /// Allocating a node of given size will use the appropriate free list.
- /// This allocator is ideal for \concept{concept_node,node} allocations in any order but with a predefined set of sizes, - /// not only one size like \ref memory_pool. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class memory_pool_collection -@@ -398,7 +398,7 @@ namespace foonathan - - /// An alias for \ref memory_pool_collection using the \ref identity_buckets policy - /// and a \c PoolType defaulting to \ref node_pool. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - FOONATHAN_ALIAS_TEMPLATE(bucket_allocator, - memory_pool_collection); -@@ -409,7 +409,7 @@ namespace foonathan - /// Specialization of the \ref allocator_traits for \ref memory_pool_collection classes. - /// \note It is not allowed to mix calls through the specialization and through the member functions, - /// i.e. \ref memory_pool_collection::allocate_node() and this \c allocate_node(). -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class allocator_traits> - { -@@ -484,7 +484,7 @@ namespace foonathan - }; - - /// Specialization of the \ref composable_allocator_traits for \ref memory_pool_collection classes. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class composable_allocator_traits> - { -diff --git a/include/foonathan/memory/memory_pool_type.hpp b/include/foonathan/memory/memory_pool_type.hpp -index 714edea4104810189752efb5fe42f08422ee4f06..990c8ac2f7b8bb6f57cc532e3c65a9fd547f6cd9 100644 ---- a/include/foonathan/memory/memory_pool_type.hpp -+++ b/include/foonathan/memory/memory_pool_type.hpp -@@ -20,7 +20,7 @@ namespace foonathan - /// Tag type defining a memory pool optimized for nodes. - /// It does not support array allocations that great and may trigger a growth even if there is enough memory. - /// But it is the fastest pool type. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - struct node_pool : FOONATHAN_EBO(std::true_type) - { - using type = detail::node_free_memory_list; -@@ -31,7 +31,7 @@ namespace foonathan - /// Array allocations are still pretty slow, if the array gets big enough it can get slower than \c new. - /// Node allocations are still fast, unless there is deallocation in random order. - /// \note Use this tag type only if you really need to have a memory pool! -- /// \ingroup allocator -+ /// \ingroup memory_allocator - struct array_pool : FOONATHAN_EBO(std::true_type) - { - using type = detail::array_free_memory_list; -@@ -41,7 +41,7 @@ namespace foonathan - /// The free list is intrusive and thus requires that each node has at least the size of a pointer. - /// This tag type does not have this requirement and thus allows zero-memory-overhead allocations of small nodes. - /// It is a little bit slower than \ref node_pool and does not support arrays. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - struct small_node_pool : FOONATHAN_EBO(std::false_type) - { - using type = detail::small_free_memory_list; -diff --git a/include/foonathan/memory/memory_resource_adapter.hpp b/include/foonathan/memory/memory_resource_adapter.hpp -index 7ff48f16f71068435ea52b385f27af3a76976343..cf58eed1f0134c5236ae20be4f095bb31244a4a1 100644 ---- a/include/foonathan/memory/memory_resource_adapter.hpp -+++ b/include/foonathan/memory/memory_resource_adapter.hpp -@@ -87,11 +87,11 @@ namespace foonathan - namespace memory - { - /// The \c memory_resource abstract base class used in the implementation. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - FOONATHAN_ALIAS_TEMPLATE(memory_resource, foonathan_memory_pmr::memory_resource); - - /// Wraps a \concept{concept_rawallocator,RawAllocator} and makes it a \ref memory_resource. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class memory_resource_adapter - : public memory_resource, -@@ -163,7 +163,7 @@ namespace foonathan - }; - - /// Wraps a \ref memory_resource and makes it a \concept{concept_rawallocator,RawAllocator}. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - class memory_resource_allocator - { - public: -@@ -227,7 +227,7 @@ namespace foonathan - - /// Specialization of \ref is_shared_allocator to mark \ref memory_resource_allocator as shared. - /// This allows using it as \ref allocator_reference directly. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template <> - struct is_shared_allocator : std::true_type - { -diff --git a/include/foonathan/memory/memory_stack.hpp b/include/foonathan/memory/memory_stack.hpp -index b3dcd0f2ec40be759c93be2c58942ae6a8da639b..dc9f1226ab504546e06d471ac48bee4a1b50fcda 100644 ---- a/include/foonathan/memory/memory_stack.hpp -+++ b/include/foonathan/memory/memory_stack.hpp -@@ -97,7 +97,7 @@ namespace foonathan - /// and saves a marker to the current top. - /// Allocation simply moves this marker by the appropriate number of bytes and returns the pointer at the old marker position, - /// deallocation is not directly supported, only setting the marker to a previously queried position. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class memory_stack - : FOONATHAN_EBO(detail::default_leak_checker) -@@ -276,7 +276,7 @@ namespace foonathan - /// A `Stack` is anything that provides a `marker`, a `top()` function returning a `marker` - /// and an `unwind()` function to unwind to a `marker`, - /// like a \ref foonathan::memory::memory_stack -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template > - class memory_stack_raii_unwind - { -@@ -379,7 +379,7 @@ namespace foonathan - /// Specialization of the \ref allocator_traits for \ref memory_stack classes. - /// \note It is not allowed to mix calls through the specialization and through the member functions, - /// i.e. \ref memory_stack::allocate() and this \c allocate_node(). -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class allocator_traits> - { -@@ -441,7 +441,7 @@ namespace foonathan - }; - - /// Specialization of the \ref composable_allocator_traits for \ref memory_stack classes. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - class composable_allocator_traits> - { -diff --git a/include/foonathan/memory/namespace_alias.hpp b/include/foonathan/memory/namespace_alias.hpp -index a3e0354a7532e9c1d74c6c9dff27485d30b8d525..9a688f550d736aa8328e27c970e9018ec0869c5f 100644 ---- a/include/foonathan/memory/namespace_alias.hpp -+++ b/include/foonathan/memory/namespace_alias.hpp -@@ -7,13 +7,18 @@ - /// \file - /// Convenient namespace alias. - --/// \defgroup core Core components -+/// \defgroup memory Memory Allocator Library -+/// @{ - --/// \defgroup allocator Allocator implementations -+/// \defgroup memory_core Core components - --/// \defgroup adapter Adapters and Wrappers -+/// \defgroup memory_allocator Allocator implementations - --/// \defgroup storage Allocator storage -+/// \defgroup memory_adapter Adapters and Wrappers -+ -+/// \defgroup memory_storage Allocator storage -+ -+/// @} - - /// \namespace foonathan - /// Foonathan namespace. -@@ -32,5 +37,5 @@ namespace foonathan - } // namespace foonathan - - namespace memory = foonathan::memory; -- -+///@} - #endif // FOONATHAN_MEMORY_NAMESPACE_ALIAS_HPP_INCLUDED -diff --git a/include/foonathan/memory/new_allocator.hpp b/include/foonathan/memory/new_allocator.hpp -index 61fb5dbceff04639a8092519f0af5ec40ea2032d..5d11038ae6fce0379c7aeddd470ea1ad4744f5b7 100644 ---- a/include/foonathan/memory/new_allocator.hpp -+++ b/include/foonathan/memory/new_allocator.hpp -@@ -40,7 +40,7 @@ namespace foonathan - /// A stateless \concept{concept_rawallocator,RawAllocator} that allocates memory using (nothrow) operator new. - /// If the operator returns \c nullptr, it behaves like \c new and loops calling \c std::new_handler, - /// but instead of throwing a \c std::bad_alloc exception, it throws \ref out_of_memory. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - using new_allocator = - FOONATHAN_IMPL_DEFINED(detail::lowlevel_allocator); - -diff --git a/include/foonathan/memory/segregator.hpp b/include/foonathan/memory/segregator.hpp -index 80e066bf0a6178e2404ebd65332dde01a3606fab..75dad5ebbb795b91b919c2e3ac72de396a77c88e 100644 ---- a/include/foonathan/memory/segregator.hpp -+++ b/include/foonathan/memory/segregator.hpp -@@ -18,7 +18,7 @@ namespace foonathan - namespace memory - { - /// A \concept{concept_segregatable,Segregatable} that allocates until a maximum size. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class threshold_segregatable : FOONATHAN_EBO(allocator_traits::allocator_type) - { -@@ -78,7 +78,7 @@ namespace foonathan - - /// A composable \concept{concept_rawallocator,RawAllocator} that will always fail. - /// This is useful for compositioning or as last resort in \ref binary_segregator. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - class null_allocator - { - public: -@@ -119,7 +119,7 @@ namespace foonathan - /// A \concept{concept_rawallocator,RawAllocator} that either uses the \concept{concept_segregatable,Segregatable} or the other `RawAllocator`. - /// It is a faster alternative to \ref fallback_allocator that doesn't require a composable allocator - /// and decides about the allocator to use purely with the `Segregatable` based on size and alignment. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class binary_segregator - : FOONATHAN_EBO( -@@ -375,7 +375,7 @@ namespace foonathan - /// the result is `binary_segregator>`. - /// \note It will result in an allocator that tries each `Segregatable` in the order specified - /// using the last parameter as final fallback. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - FOONATHAN_ALIAS_TEMPLATE(segregator, - typename detail::make_segregator_t::type); -diff --git a/include/foonathan/memory/smart_ptr.hpp b/include/foonathan/memory/smart_ptr.hpp -index 9964495583e9f024b5242d08bb03f06ddae96a3d..f8508a404e9476b449b7ed5853b0dcdd65630e2f 100644 ---- a/include/foonathan/memory/smart_ptr.hpp -+++ b/include/foonathan/memory/smart_ptr.hpp -@@ -88,7 +88,7 @@ namespace foonathan - /// A \c std::unique_ptr that deletes using a \concept{concept_rawallocator,RawAllocator}. - /// - /// It is an alias template using \ref allocator_deleter as \c Deleter class. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - FOONATHAN_ALIAS_TEMPLATE(unique_ptr, - std::unique_ptr>); -@@ -99,7 +99,7 @@ namespace foonathan - /// and is meant to be used inside containers. - /// It is an alias template using \ref allocator_polymorphic_deleter as \c Deleter class. - /// \note It has a relatively high overhead, so only use it if you have to. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - FOONATHAN_ALIAS_TEMPLATE( - unique_base_ptr, -@@ -111,7 +111,7 @@ namespace foonathan - /// \returns A \c std::unique_ptr owning that memory. - /// \note If the allocator is stateful a reference to the \c RawAllocator will be stored inside the deleter, - /// the caller has to ensure that the object lives as long as the smart pointer. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - auto allocate_unique(RawAllocator&& alloc, Args&&... args) -> FOONATHAN_REQUIRES_RET( - !std::is_array::value, -@@ -129,7 +129,7 @@ namespace foonathan - /// \returns A \c std::unique_ptr with a type-erased allocator reference owning that memory. - /// \note If the allocator is stateful a reference to the \c RawAllocator will be stored inside the deleter, - /// the caller has to ensure that the object lives as long as the smart pointer. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - auto allocate_unique(any_allocator, RawAllocator&& alloc, Args&&... args) - -> FOONATHAN_REQUIRES_RET(!std::is_array::value, -@@ -146,7 +146,7 @@ namespace foonathan - /// \returns A \c std::unique_ptr owning that array. - /// \note If the allocator is stateful a reference to the \c RawAllocator will be stored inside the deleter, - /// the caller has to ensure that the object lives as long as the smart pointer. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - auto allocate_unique(RawAllocator&& alloc, std::size_t size) -> FOONATHAN_REQUIRES_RET( - std::is_array::value, -@@ -164,7 +164,7 @@ namespace foonathan - /// \returns A \c std::unique_ptr with a type-erased allocator reference owning that array. - /// \note If the allocator is stateful a reference to the \c RawAllocator will be stored inside the deleter, - /// the caller has to ensure that the object lives as long as the smart pointer. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - auto allocate_unique(any_allocator, RawAllocator&& alloc, std::size_t size) - -> FOONATHAN_REQUIRES_RET(std::is_array::value, -@@ -183,7 +183,7 @@ namespace foonathan - /// \returns A \c std::shared_ptr created using \c std::allocate_shared. - /// \note If the allocator is stateful a reference to the \c RawAllocator will be stored inside the shared pointer, - /// the caller has to ensure that the object lives as long as the smart pointer. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - std::shared_ptr allocate_shared(RawAllocator&& alloc, Args&&... args) - { -diff --git a/include/foonathan/memory/static_allocator.hpp b/include/foonathan/memory/static_allocator.hpp -index 17552b439a560cb576787c94fb7ae0593a2fedd4..580fa2be8f5b1a291d1864558cb75328c4baff3f 100644 ---- a/include/foonathan/memory/static_allocator.hpp -+++ b/include/foonathan/memory/static_allocator.hpp -@@ -27,7 +27,7 @@ namespace foonathan - /// Its constructor will take a reference to it and use it for its allocation. - /// The storage type is simply a \c char array aligned for maximum alignment. - /// \note It is not allowed to access the memory of the storage. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template - struct static_allocator_storage - { -@@ -43,7 +43,7 @@ namespace foonathan - /// It works on a \ref static_allocator_storage and uses its memory for all allocations. - /// Deallocations are not supported, memory cannot be marked as freed.
- /// \note It is not allowed to share an \ref static_allocator_storage between multiple \ref static_allocator objects. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - class static_allocator - { - public: -@@ -100,7 +100,7 @@ namespace foonathan - /// It works on a \ref static_allocator_storage and uses it for all allocations, - /// deallocations are only allowed in reversed order which is guaranteed by \ref memory_arena. - /// \note It is not allowed to share an \ref static_allocator_storage between multiple \ref static_allocator objects. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - class static_block_allocator - { - public: -diff --git a/include/foonathan/memory/std_allocator.hpp b/include/foonathan/memory/std_allocator.hpp -index e865915b133b1cb046d484471990c49b7bb2babe..33b2f5489b290f9cf3d3ad710373e2f982928f12 100644 ---- a/include/foonathan/memory/std_allocator.hpp -+++ b/include/foonathan/memory/std_allocator.hpp -@@ -44,7 +44,7 @@ namespace foonathan - } // namespace traits_detail - - /// Controls the propagation of a \ref std_allocator for a certain \concept{concept_rawallocator,RawAllocator}. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - struct propagation_traits - { -@@ -69,7 +69,7 @@ namespace foonathan - - /// Wraps a \concept{concept_rawallocator,RawAllocator} and makes it a "normal" \c Allocator. - /// It allows using a \c RawAllocator anywhere a \c Allocator is required. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class std_allocator : - #if defined _MSC_VER && defined __clang__ -@@ -344,7 +344,7 @@ namespace foonathan - /// An alias template for \ref std_allocator using a type-erased \concept{concept_rawallocator,RawAllocator}. - /// This is the same as using a \ref std_allocator with the tag type \ref any_allocator. - /// The implementation is optimized to call fewer virtual functions. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - FOONATHAN_ALIAS_TEMPLATE(any_std_allocator, std_allocator); - -diff --git a/include/foonathan/memory/temporary_allocator.hpp b/include/foonathan/memory/temporary_allocator.hpp -index 3b6269d7ff139a073aa5dc7cb7d27360a567871b..135d250bc15ee074a22b3c210b541dcff98e6d83 100644 ---- a/include/foonathan/memory/temporary_allocator.hpp -+++ b/include/foonathan/memory/temporary_allocator.hpp -@@ -91,7 +91,7 @@ namespace foonathan - - /// A wrapper around the \ref memory_stack that is used by the \ref temporary_allocator. - /// There should be at least one per-thread. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - class temporary_stack : FOONATHAN_EBO(detail::temporary_stack_list_node) - { - public: -@@ -215,7 +215,7 @@ namespace foonathan - /// This avoids the stack overflow error and is portable, - /// with a similar speed. - /// All allocations done in the scope of the allocator object are automatically freed when the object is destroyed. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - class temporary_allocator - { - public: -@@ -267,7 +267,7 @@ namespace foonathan - /// Specialization of the \ref allocator_traits for \ref temporary_allocator classes. - /// \note It is not allowed to mix calls through the specialization and through the member functions, - /// i.e. \ref temporary_allocator::allocate() and this \c allocate_node(). -- /// \ingroup allocator -+ /// \ingroup memory_allocator - template <> - class allocator_traits - { -diff --git a/include/foonathan/memory/threading.hpp b/include/foonathan/memory/threading.hpp -index 4cf507c45296a0d60847c285865473024633b0d0..52b3998b2c7b7ee5c4b0def5857ddaf6f65e8435 100644 ---- a/include/foonathan/memory/threading.hpp -+++ b/include/foonathan/memory/threading.hpp -@@ -22,7 +22,7 @@ namespace foonathan - { - /// A dummy \c Mutex class that does not lock anything. - /// It is a valid \c Mutex and can be used to disable locking anywhere a \c Mutex is requested. -- /// \ingroup core -+ /// \ingroup memory_core - struct no_mutex - { - void lock() noexcept {} -@@ -39,7 +39,7 @@ namespace foonathan - /// This allows to use \ref no_mutex as an optimization. - /// Note that stateless allocators are implictly thread-safe. - /// Specialize it only for your own stateful allocators. -- /// \ingroup core -+ /// \ingroup memory_core - template - struct is_thread_safe_allocator - : std::integral_constant::is_stateful::value> -diff --git a/include/foonathan/memory/tracking.hpp b/include/foonathan/memory/tracking.hpp -index 57fb0d1cb477d8a188a5681b59710436dc34f541..222e6105bf35d884fa4e472f077ebf58a721894a 100644 ---- a/include/foonathan/memory/tracking.hpp -+++ b/include/foonathan/memory/tracking.hpp -@@ -74,7 +74,7 @@ namespace foonathan - /// The class can then be used anywhere a \concept{concept_blockallocator,BlockAllocator} is required and the memory usage will be tracked.
- /// It will only call the on_allocator_growth() and on_allocator_shrinking() tracking functions, - /// since a \concept{concept_blockallocator,BlockAllocator} is normally used inside higher allocators only. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class tracked_block_allocator - : FOONATHAN_EBO(Tracker, make_block_allocator_t) -@@ -154,7 +154,7 @@ namespace foonathan - /// Similar to \ref tracked_block_allocator, but shares the tracker with the higher level allocator. - /// This allows tracking both (de-)allocations and growth with one tracker. - /// \note Due to implementation reasons, it cannot track growth and shrinking in the constructor/destructor of the higher level allocator. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - using deeply_tracked_block_allocator = FOONATHAN_IMPL_DEFINED( - detail::deeply_tracked_block_allocator - /// If the \concept{concept_rawallocator,RawAllocator} uses \ref deeply_tracked_block_allocator as \concept{concept_blockallocator,BlockAllocator}, - /// it will also track growth and shrinking of the allocator. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - class tracked_allocator - : FOONATHAN_EBO(Tracker, allocator_traits::allocator_type) -@@ -406,7 +406,7 @@ namespace foonathan - /// A \ref tracked_allocator that has rebound any \concept{concept_blockallocator,BlockAllocator} to the corresponding \ref deeply_tracked_block_allocator. - /// This makes it a deeply tracked allocator.
- /// It replaces each template argument of the given \concept{concept_rawallocator,RawAllocator} for which \ref is_block_allocator or \ref is_raw_allocator is \c true with a \ref deeply_tracked_block_allocator. -- /// \ingroup adapter -+ /// \ingroup memory_adapter - template - FOONATHAN_ALIAS_TEMPLATE( - deeply_tracked_allocator, -diff --git a/include/foonathan/memory/virtual_memory.hpp b/include/foonathan/memory/virtual_memory.hpp -index 68705e9738a166da04c159a3a8f04e7ce33d94ad..35f7ccd54fdda08c504696b0719d16ec27d6c9e9 100644 ---- a/include/foonathan/memory/virtual_memory.hpp -+++ b/include/foonathan/memory/virtual_memory.hpp -@@ -36,14 +36,14 @@ namespace foonathan - /// The page size of the virtual memory. - /// All virtual memory allocations must be multiple of this size. - /// It is usually 4KiB. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - /// \deprecated use \ref get_virtual_memory_page_size instead. - extern const std::size_t virtual_memory_page_size; - - /// \returns the page size of the virtual memory. - /// All virtual memory allocations must be multiple of this size. - /// It is usually 4KiB. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - std::size_t get_virtual_memory_page_size() noexcept; - - /// Reserves virtual memory. -@@ -52,33 +52,33 @@ namespace foonathan - /// \returns The address of the first reserved page, - /// or \c nullptr in case of error. - /// \note The memory may not be used, it must first be commited. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - void* virtual_memory_reserve(std::size_t no_pages) noexcept; - - /// Releases reserved virtual memory. - /// \effects Returns previously reserved pages to the system. - /// \requires \c pages must come from a previous call to \ref virtual_memory_reserve with the same \c calc_no_pages, - /// it must not be \c nullptr. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - void virtual_memory_release(void* pages, std::size_t no_pages) noexcept; - - /// Commits reserved virtual memory. - /// \effects Marks \c calc_no_pages pages starting at the given address available for use. - /// \returns The beginning of the committed area, i.e. \c memory, or \c nullptr in case of error. - /// \requires The memory must be previously reserved. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - void* virtual_memory_commit(void* memory, std::size_t no_pages) noexcept; - - /// Decommits commited virtual memory. - /// \effects Puts commited memory back in the reserved state. - /// \requires \c memory must come from a previous call to \ref virtual_memory_commit with the same \c calc_no_pages - /// it must not be \c nullptr. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - void virtual_memory_decommit(void* memory, std::size_t no_pages) noexcept; - - /// A stateless \concept{concept_rawallocator,RawAllocator} that allocates memory using the virtual memory allocation functions. - /// It does not prereserve any memory and will always reserve and commit combined. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - class virtual_memory_allocator - : FOONATHAN_EBO(detail::global_leak_checker) - { -@@ -125,7 +125,7 @@ namespace foonathan - /// A \concept{concept_blockallocator,BlockAllocator} that reserves virtual memory and commits it part by part. - /// It is similar to \ref memory_stack but does not support growing and uses virtual memory, - /// also meant for big blocks not small allocations. -- /// \ingroup allocator -+ /// \ingroup memory_allocator - class virtual_block_allocator - { - public: diff --git a/upstream_utils/memory_patches/0002-Remove-conflicting-doxygen-concept-alias.patch b/upstream_utils/memory_patches/0002-Remove-conflicting-doxygen-concept-alias.patch deleted file mode 100644 index 2afa05cc80..0000000000 --- a/upstream_utils/memory_patches/0002-Remove-conflicting-doxygen-concept-alias.patch +++ /dev/null @@ -1,1459 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ryan Blue -Date: Wed, 21 Aug 2024 21:47:32 -0400 -Subject: [PATCH 2/3] Remove conflicting doxygen 'concept' alias - -\concept was added as a doxygen command in 1.9.2 and is meant to be applied to concepts. Inserting them into standard comment paragraphs causes doxygen to interpret the following text as a concept name and add it to the documentation, as well as remove the text from the paragraph. -In the upstream repo, this alias links to markdown documentation, so it's not usable for us anyways. ---- - .../foonathan/memory/aligned_allocator.hpp | 2 +- - .../foonathan/memory/allocator_storage.hpp | 20 +++---- - include/foonathan/memory/allocator_traits.hpp | 12 ++--- - include/foonathan/memory/container.hpp | 8 +-- - .../foonathan/memory/default_allocator.hpp | 4 +- - include/foonathan/memory/deleter.hpp | 6 +-- - .../foonathan/memory/fallback_allocator.hpp | 6 +-- - include/foonathan/memory/heap_allocator.hpp | 2 +- - .../foonathan/memory/iteration_allocator.hpp | 10 ++-- - include/foonathan/memory/joint_allocator.hpp | 8 +-- - include/foonathan/memory/malloc_allocator.hpp | 2 +- - include/foonathan/memory/memory_arena.hpp | 42 +++++++-------- - include/foonathan/memory/memory_pool.hpp | 46 ++++++++-------- - .../memory/memory_pool_collection.hpp | 52 +++++++++---------- - .../memory/memory_resource_adapter.hpp | 6 +-- - include/foonathan/memory/memory_stack.hpp | 18 +++---- - include/foonathan/memory/new_allocator.hpp | 2 +- - include/foonathan/memory/segregator.hpp | 28 +++++----- - include/foonathan/memory/smart_ptr.hpp | 16 +++--- - include/foonathan/memory/static_allocator.hpp | 10 ++-- - include/foonathan/memory/std_allocator.hpp | 10 ++-- - .../foonathan/memory/temporary_allocator.hpp | 2 +- - include/foonathan/memory/threading.hpp | 2 +- - include/foonathan/memory/tracking.hpp | 28 +++++----- - include/foonathan/memory/virtual_memory.hpp | 10 ++-- - 25 files changed, 176 insertions(+), 176 deletions(-) - -diff --git a/include/foonathan/memory/aligned_allocator.hpp b/include/foonathan/memory/aligned_allocator.hpp -index 5ca3f29b20575a36ef11327bb1219cb4013fc5e4..f9b190de4877df70c564dc5984b1f70d4fa925cf 100644 ---- a/include/foonathan/memory/aligned_allocator.hpp -+++ b/include/foonathan/memory/aligned_allocator.hpp -@@ -18,7 +18,7 @@ namespace foonathan - { - namespace memory - { -- /// A \concept{concept_rawallocator,RawAllocator} adapter that ensures a minimum alignment. -+ /// A RawAllocator adapter that ensures a minimum alignment. - /// It adjusts the alignment value so that it is always larger than the minimum and forwards to the specified allocator. - /// \ingroup memory_adapter - template -diff --git a/include/foonathan/memory/allocator_storage.hpp b/include/foonathan/memory/allocator_storage.hpp -index 11747a5b15c500243764094dba3163cc9e014390..a7931503369110298602e8919c37b34577d7b6be 100644 ---- a/include/foonathan/memory/allocator_storage.hpp -+++ b/include/foonathan/memory/allocator_storage.hpp -@@ -85,8 +85,8 @@ namespace foonathan - } - } // namespace detail - -- /// A \concept{concept_rawallocator,RawAllocator} that stores another allocator. -- /// The \concept{concept_storagepolicy,StoragePolicy} defines the allocator type being stored and how it is stored. -+ /// A RawAllocator that stores another allocator. -+ /// The StoragePolicy defines the allocator type being stored and how it is stored. - /// The \c Mutex controls synchronization of the access. - /// \ingroup memory_storage - template -@@ -322,7 +322,7 @@ namespace foonathan - { - }; - -- /// A \concept{concept_storagepolicy,StoragePolicy} that stores the allocator directly. -+ /// A StoragePolicy that stores the allocator directly. - /// It embeds the allocator inside it, i.e. moving the storage policy will move the allocator. - /// \ingroup memory_storage - template -@@ -379,7 +379,7 @@ namespace foonathan - }; - - /// An alias template for \ref allocator_storage using the \ref direct_storage policy without a mutex. -- /// It has the effect of giving any \concept{concept_rawallocator,RawAllocator} the interface with all member functions, -+ /// It has the effect of giving any RawAllocator the interface with all member functions, - /// avoiding the need to wrap it inside the \ref allocator_traits. - /// \ingroup memory_storage - template -@@ -521,7 +521,7 @@ namespace foonathan - }; - } // namespace detail - -- /// Specifies whether or not a \concept{concept_rawallocator,RawAllocator} has shared semantics. -+ /// Specifies whether or not a RawAllocator has shared semantics. - /// It is shared, if - like \ref allocator_reference - if multiple objects refer to the same internal allocator and if it can be copied. - /// This sharing is stateful, however, stateless allocators are not considered shared in the meaning of this traits.
- /// If a \c RawAllocator is shared, it will be directly embedded inside \ref reference_storage since it already provides \ref allocator_reference like semantics, so there is no need to add them manually,
-@@ -534,7 +534,7 @@ namespace foonathan - { - }; - -- /// A \concept{concept_storagepolicy,StoragePolicy} that stores a reference to an allocator. -+ /// A StoragePolicy that stores a reference to an allocator. - /// For stateful allocators it only stores a pointer to an allocator object and copying/moving only copies the pointer. - /// For stateless allocators it does not store anything, an allocator will be constructed as needed. - /// For allocators that are already shared (determined through \ref is_shared_allocator) it will store the allocator type directly. -@@ -711,7 +711,7 @@ namespace foonathan - public: - using allocator_type = FOONATHAN_IMPL_DEFINED(base_allocator); - -- /// \effects Creates it from a reference to any stateful \concept{concept_rawallocator,RawAllocator}. -+ /// \effects Creates it from a reference to any stateful RawAllocator. - /// It will store a pointer to this allocator object. - /// \note The user has to take care that the lifetime of the reference does not exceed the allocator lifetime. - template -@@ -723,7 +723,7 @@ namespace foonathan - ::new (static_cast(&storage_)) basic_allocator(alloc); - } - -- // \effects Creates it from any stateless \concept{concept_rawallocator,RawAllocator}. -+ // \effects Creates it from any stateless RawAllocator. - /// It will not store anything, only creates the allocator as needed. - /// \requires The \c RawAllocator is stateless. - template -@@ -771,7 +771,7 @@ namespace foonathan - - /// \returns A reference to the allocator. - /// The actual type is implementation-defined since it is the base class used in the type-erasure, -- /// but it provides the full \concept{concept_rawallocator,RawAllocator} member functions. -+ /// but it provides the full RawAllocator member functions. - /// \note There is no way to access any custom member functions of the allocator type. - allocator_type& get_allocator() const noexcept - { -@@ -913,7 +913,7 @@ namespace foonathan - using any_reference_storage = reference_storage; - - /// An alias for \ref allocator_storage using the \ref any_reference_storage. -- /// It will store a reference to any \concept{concept_rawallocator,RawAllocator}. -+ /// It will store a reference to any RawAllocator. - /// This is the same as passing the tag type \ref any_allocator to the alias \ref allocator_reference. - /// Wrap the allocator in a \ref thread_safe_allocator if you want thread safety. - /// \ingroup memory_storage -diff --git a/include/foonathan/memory/allocator_traits.hpp b/include/foonathan/memory/allocator_traits.hpp -index 03b7ecdebc3511a07a1305b3101f28a6e304abc3..46a77ebac31ff33d451890b12f3530cefe42e151 100644 ---- a/include/foonathan/memory/allocator_traits.hpp -+++ b/include/foonathan/memory/allocator_traits.hpp -@@ -50,7 +50,7 @@ namespace foonathan - }; - } // namespace detail - -- /// Traits class that checks whether or not a standard \c Allocator can be used as \concept{concept_rawallocator,RawAllocator}. -+ /// Traits class that checks whether or not a standard \c Allocator can be used as RawAllocator. - /// It checks the existence of a custom \c construct(), \c destroy() function, if provided, - /// it cannot be used since it would not be called.
- /// Specialize it for custom \c Allocator types to override this check. -@@ -283,7 +283,7 @@ namespace foonathan - } - } // namespace traits_detail - -- /// The default specialization of the allocator_traits for a \concept{concept_rawallocator,RawAllocator}. -+ /// The default specialization of the allocator_traits for a RawAllocator. - /// See the last link for the requirements on types that do not specialize this class and the interface documentation. - /// Any specialization must provide the same interface. - /// \ingroup memory_core -@@ -408,7 +408,7 @@ namespace foonathan - }; - } // namespace detail - -- /// Traits that check whether a type models concept \concept{concept_rawallocator,RawAllocator}.
-+ /// Traits that check whether a type models concept RawAllocator.
- /// It must either provide the necessary functions for the default traits specialization or has specialized it. - /// \ingroup memory_core - template -@@ -491,7 +491,7 @@ namespace foonathan - } - } // namespace traits_detail - -- /// The default specialization of the composable_allocator_traits for a \concept{concept_composableallocator,ComposableAllocator}. -+ /// The default specialization of the composable_allocator_traits for a ComposableAllocator. - /// See the last link for the requirements on types that do not specialize this class and the interface documentation. - /// Any specialization must provide the same interface. - /// \ingroup memory_core -@@ -586,8 +586,8 @@ namespace foonathan - }; - } // namespace detail - -- /// Traits that check whether a type models concept \concept{concept_rawallocator,ComposableAllocator}.
-- /// It must be a \concept{concept_rawallocator,RawAllocator} and either provide the necessary functions for the default traits specialization or has specialized it. -+ /// Traits that check whether a type models concept ComposableAllocator.
-+ /// It must be a RawAllocator and either provide the necessary functions for the default traits specialization or has specialized it. - /// \ingroup memory_core - template - struct is_composable_allocator -diff --git a/include/foonathan/memory/container.hpp b/include/foonathan/memory/container.hpp -index c954ca5deece3f4430fb934642b60e2e4550deff..307ca115ea529655666c81766f385dda5ac68c3b 100644 ---- a/include/foonathan/memory/container.hpp -+++ b/include/foonathan/memory/container.hpp -@@ -5,7 +5,7 @@ - #define FOONATHAN_MEMORY_CONTAINER_HPP_INCLUDED - - /// \file --/// Aliasas for STL containers using a certain \concept{concept_rawallocator,RawAllocator}. -+/// Aliasas for STL containers using a certain RawAllocator. - /// \note Only available on a hosted implementation. - - #include "config.hpp" -@@ -40,7 +40,7 @@ namespace foonathan - /// @{ - - /// Alias template for an STL container that uses a certain -- /// \concept{concept_rawallocator,RawAllocator}. It is just a shorthand for a passing in the \c -+ /// RawAllocator. It is just a shorthand for a passing in the \c - /// RawAllocator wrapped in a \ref foonathan::memory::std_allocator. - template - FOONATHAN_ALIAS_TEMPLATE(vector, std::vector>); -@@ -212,7 +212,7 @@ namespace foonathan - - /// @{ - /// Convenience function to create a container adapter using a certain -- /// \concept{concept_rawallocator,RawAllocator}. \returns An empty adapter with an -+ /// RawAllocator. \returns An empty adapter with an - /// implementation container using a reference to a given allocator. \ingroup memory_adapter - template > - std::stack make_stack(RawAllocator& allocator) -@@ -355,7 +355,7 @@ namespace foonathan - #if !defined(FOONATHAN_MEMORY_NO_NODE_SIZE) - /// The node size required by \ref allocate_shared. - /// \note This is similar to \ref shared_ptr_node_size but takes a -- /// \concept{concept_rawallocator,RawAllocator} instead. -+ /// RawAllocator instead. - template - struct allocate_shared_node_size : shared_ptr_node_size> - { -diff --git a/include/foonathan/memory/default_allocator.hpp b/include/foonathan/memory/default_allocator.hpp -index 8466bc3a6ecac6cc1ef7c95cb78206b2e56dbf57..f61d3a1385ffafd3d9ffde6322e6cd99c56a9d21 100644 ---- a/include/foonathan/memory/default_allocator.hpp -+++ b/include/foonathan/memory/default_allocator.hpp -@@ -21,9 +21,9 @@ namespace foonathan - { - namespace memory - { -- /// The default \concept{concept_rawallocator,RawAllocator} that will be used as \concept{concept_blockallocator,BlockAllocator} in memory arenas. -+ /// The default RawAllocator that will be used as BlockAllocator in memory arenas. - /// Arena allocators like \ref memory_stack or \ref memory_pool allocate memory by subdividing a huge block. -- /// They get a \concept{concept_blockallocator,BlockAllocator} that will be used for their internal allocation, -+ /// They get a BlockAllocator that will be used for their internal allocation, - /// this type is the default value. - /// \requiredbe Its type can be changed via the CMake option \c FOONATHAN_MEMORY_DEFAULT_ALLCOATOR, - /// but it must be one of the following: \ref heap_allocator, \ref new_allocator, \ref malloc_allocator, \ref static_allocator, \ref virtual_memory_allocator. -diff --git a/include/foonathan/memory/deleter.hpp b/include/foonathan/memory/deleter.hpp -index fe3ce220dc751ed86b2f4822693f4524f53d47d1..1d87323a522216e484f8fc94a0db38fac1d1bd7c 100644 ---- a/include/foonathan/memory/deleter.hpp -+++ b/include/foonathan/memory/deleter.hpp -@@ -5,7 +5,7 @@ - #define FOONATHAN_MEMORY_DELETER_HPP_INCLUDED - - /// \file --/// \c Deleter classes using a \concept{concept_rawallocator,RawAllocator}. -+/// \c Deleter classes using a RawAllocator. - - #include - -@@ -17,7 +17,7 @@ namespace foonathan - { - namespace memory - { -- /// A deleter class that deallocates the memory through a specified \concept{concept_rawallocator,RawAllocator}. -+ /// A deleter class that deallocates the memory through a specified RawAllocator. - /// - /// It deallocates memory for a specified type but does not call its destructors. - /// \ingroup memory_adapter -@@ -116,7 +116,7 @@ namespace foonathan - std::size_t size_; - }; - -- /// A deleter class that deallocates the memory of a derived type through a specified \concept{concept_rawallocator,RawAllocator}. -+ /// A deleter class that deallocates the memory of a derived type through a specified RawAllocator. - /// - /// It can only be created from a \ref allocator_deallocator and thus must only be used for smart pointers initialized by derived-to-base conversion of the pointer. - /// \ingroup memory_adapter -diff --git a/include/foonathan/memory/fallback_allocator.hpp b/include/foonathan/memory/fallback_allocator.hpp -index b4157062d42060be4fe649fe1e84af5aec0567cf..5e164cb8af2db919b2e0c3c101bf708880aa0545 100644 ---- a/include/foonathan/memory/fallback_allocator.hpp -+++ b/include/foonathan/memory/fallback_allocator.hpp -@@ -16,11 +16,11 @@ namespace foonathan - { - namespace memory - { -- /// A \concept{raw_allocator,RawAllocator} with a fallback. -+ /// A RawAllocator with a fallback. - /// Allocation first tries `Default`, if it fails, - /// it uses `Fallback`. -- /// \requires `Default` must be a composable \concept{concept_rawallocator,RawAllocator}, -- /// `Fallback` must be a \concept{concept_rawallocator,RawAllocator}. -+ /// \requires `Default` must be a composable RawAllocator, -+ /// `Fallback` must be a RawAllocator. - /// \ingroup memory_adapter - template - class fallback_allocator -diff --git a/include/foonathan/memory/heap_allocator.hpp b/include/foonathan/memory/heap_allocator.hpp -index ed8f2fb9af2d593fde141b3bdb8b17e8074f8c9c..88e8d7cb5711fd564caa9262d3390af81b3bd4df 100644 ---- a/include/foonathan/memory/heap_allocator.hpp -+++ b/include/foonathan/memory/heap_allocator.hpp -@@ -65,7 +65,7 @@ namespace foonathan - heap_alloator_leak_checker) - } // namespace detail - -- /// A stateless \concept{concept_rawallocator,RawAllocator} that allocates memory from the heap. -+ /// A stateless RawAllocator that allocates memory from the heap. - /// It uses the two functions \ref heap_alloc and \ref heap_dealloc for the allocation, - /// which default to \c std::malloc and \c std::free. - /// \ingroup memory_allocator -diff --git a/include/foonathan/memory/iteration_allocator.hpp b/include/foonathan/memory/iteration_allocator.hpp -index fdfcfa0f80d9fe5b4ea6fbec06420697f20b77b4..dbcc8f74b9feed75dc579845b23a58c828013920 100644 ---- a/include/foonathan/memory/iteration_allocator.hpp -+++ b/include/foonathan/memory/iteration_allocator.hpp -@@ -24,7 +24,7 @@ namespace foonathan - make_block_allocator_t; - } // namespace detail - -- /// A stateful \concept{concept_rawallocator,RawAllocator} that is designed for allocations in a loop. -+ /// A stateful RawAllocator that is designed for allocations in a loop. - /// It uses `N` stacks for the allocation, one of them is always active. - /// Allocation uses the currently active stack. - /// Calling \ref iteration_allocator::next_iteration() at the end of the loop, -@@ -40,7 +40,7 @@ namespace foonathan - public: - using allocator_type = detail::iteration_block_allocator; - -- /// \effects Creates it with a given initial block size and and other constructor arguments for the \concept{concept_blockallocator,BlockAllocator}. -+ /// \effects Creates it with a given initial block size and and other constructor arguments for the BlockAllocator. - /// It will allocate the first (and only) block and evenly divide it on all the stacks it uses. - template - explicit iteration_allocator(std::size_t block_size, Args&&... args) -@@ -89,7 +89,7 @@ namespace foonathan - - /// \effects Allocates a memory block of given size and alignment. - /// It simply moves the top marker of the currently active stack. -- /// \returns A \concept{concept_node,node} with given size and alignment. -+ /// \returns A node with given size and alignment. - /// \throws \ref out_of_fixed_memory if the current stack does not have any memory left. - /// \requires \c size and \c alignment must be valid. - void* allocate(std::size_t size, std::size_t alignment) -@@ -106,7 +106,7 @@ namespace foonathan - - /// \effects Allocates a memory block of given size and alignment - /// similar to \ref allocate(). -- /// \returns A \concept{concept_node,node} with given size and alignment -+ /// \returns A node with given size and alignment - /// or `nullptr` if the current stack does not have any memory left. - void* try_allocate(std::size_t size, std::size_t alignment) noexcept - { -@@ -139,7 +139,7 @@ namespace foonathan - return cur_; - } - -- /// \returns A reference to the \concept{concept_blockallocator,BlockAllocator} used for managing the memory. -+ /// \returns A reference to the BlockAllocator used for managing the memory. - /// \requires It is undefined behavior to move this allocator out into another object. - allocator_type& get_allocator() noexcept - { -diff --git a/include/foonathan/memory/joint_allocator.hpp b/include/foonathan/memory/joint_allocator.hpp -index 894ac381e82950637783ebe9f7100a95d3240da3..09e3230f9cdff7de0b5e29e4267358fb1c076698 100644 ---- a/include/foonathan/memory/joint_allocator.hpp -+++ b/include/foonathan/memory/joint_allocator.hpp -@@ -205,7 +205,7 @@ namespace foonathan - /// make sure that you do not call their regular copy/move constructors, - /// but instead the version where you pass an allocator. - /// -- /// The memory block will be managed by the given \concept{concept_rawallocator,RawAllocator}, -+ /// The memory block will be managed by the given RawAllocator, - /// it is stored in an \ref allocator_reference and not owned by the pointer directly. - /// \ingroup memory_allocator - template -@@ -220,7 +220,7 @@ namespace foonathan - - //=== constructors/destructor/assignment ===// - /// @{ -- /// \effects Creates it with a \concept{concept_rawallocator,RawAllocator}, but does not own a new object. -+ /// \effects Creates it with a RawAllocator, but does not own a new object. - explicit joint_ptr(allocator_type& alloc) noexcept - : allocator_reference(alloc), ptr_(nullptr) - { -@@ -235,7 +235,7 @@ namespace foonathan - /// @{ - /// \effects Reserves memory for the object and the additional size, - /// and creates the object by forwarding the arguments to its constructor. -- /// The \concept{concept_rawallocator,RawAllocator} will be used for the allocation. -+ /// The RawAllocator will be used for the allocation. - template - joint_ptr(allocator_type& alloc, joint_size additional_size, Args&&... args) - : joint_ptr(alloc) -@@ -493,7 +493,7 @@ namespace foonathan - } - /// @} - -- /// A \concept{concept_rawallocator,RawAllocator} that uses the additional joint memory for its allocation. -+ /// A RawAllocator that uses the additional joint memory for its allocation. - /// - /// It is somewhat limited and allows only allocation once. - /// All joint allocators for an object share the joint memory and must not be used in multiple threads. -diff --git a/include/foonathan/memory/malloc_allocator.hpp b/include/foonathan/memory/malloc_allocator.hpp -index cc3700cfe2f2339aca2808a745ae1d02b3f11ffb..f4e4c5d2eb35c62e41212d4d1491c06079c08624 100644 ---- a/include/foonathan/memory/malloc_allocator.hpp -+++ b/include/foonathan/memory/malloc_allocator.hpp -@@ -54,7 +54,7 @@ namespace foonathan - malloc_alloator_leak_checker) - } // namespace detail - -- /// A stateless \concept{concept_rawallocator,RawAllocator} that allocates memory using std::malloc(). -+ /// A stateless RawAllocator that allocates memory using std::malloc(). - /// It throws \ref out_of_memory when the allocation fails. - /// \ingroup memory_allocator - using malloc_allocator = -diff --git a/include/foonathan/memory/memory_arena.hpp b/include/foonathan/memory/memory_arena.hpp -index 645796bece4f81fd7c84c6c039b1ee619499daff..eb969a677329b5b2d536f39f9a15817f040cf79f 100644 ---- a/include/foonathan/memory/memory_arena.hpp -+++ b/include/foonathan/memory/memory_arena.hpp -@@ -5,7 +5,7 @@ - #define FOONATHAN_MEMORY_MEMORY_ARENA_HPP_INCLUDED - - /// \file --/// Class \ref foonathan::memory::memory_arena and related functionality regarding \concept{concept_blockallocator,BlockAllocators}. -+/// Class \ref foonathan::memory::memory_arena and related functionality regarding BlockAllocators. - - #include - -@@ -66,7 +66,7 @@ namespace foonathan - std::false_type is_block_allocator_impl(short); - } // namespace detail - -- /// Traits that check whether a type models concept \concept{concept_blockallocator,BlockAllocator}. -+ /// Traits that check whether a type models concept BlockAllocator. - /// \ingroup memory_core - template - struct is_block_allocator : decltype(detail::is_block_allocator_impl(0)) -@@ -264,7 +264,7 @@ namespace foonathan - /// A memory arena that manages huge memory blocks for a higher-level allocator. - /// Some allocators like \ref memory_stack work on huge memory blocks, - /// this class manages them fro those allocators. -- /// It uses a \concept{concept_blockallocator,BlockAllocator} for the allocation of those blocks. -+ /// It uses a BlockAllocator for the allocation of those blocks. - /// The memory blocks in use are put onto a stack like structure, deallocation will pop from the top, - /// so it is only possible to deallocate the last allocated block of the arena. - /// By default, blocks are not really deallocated but stored in a cache. -@@ -292,9 +292,9 @@ namespace foonathan - return detail::memory_block_stack::implementation_offset() + byte_size; - } - -- /// \effects Creates it by giving it the size and other arguments for the \concept{concept_blockallocator,BlockAllocator}. -+ /// \effects Creates it by giving it the size and other arguments for the BlockAllocator. - /// It forwards these arguments to its constructor. -- /// \requires \c block_size must be greater than \c min_block_size(0) and other requirements depending on the \concept{concept_blockallocator,BlockAllocator}. -+ /// \requires \c block_size must be greater than \c min_block_size(0) and other requirements depending on the BlockAllocator. - /// \throws Anything thrown by the constructor of the \c BlockAllocator. - template - explicit memory_arena(std::size_t block_size, Args&&... args) -@@ -303,7 +303,7 @@ namespace foonathan - FOONATHAN_MEMORY_ASSERT(block_size > min_block_size(0)); - } - -- /// \effects Deallocates all memory blocks that where requested back to the \concept{concept_blockallocator,BlockAllocator}. -+ /// \effects Deallocates all memory blocks that where requested back to the BlockAllocator. - ~memory_arena() noexcept - { - // clear cache -@@ -346,7 +346,7 @@ namespace foonathan - /// It first uses a cache of previously deallocated blocks, if caching is enabled, - /// if it is empty, allocates a new one. - /// \returns The new \ref memory_block. -- /// \throws Anything thrown by the \concept{concept_blockallocator,BlockAllocator} allocation function. -+ /// \throws Anything thrown by the BlockAllocator allocation function. - memory_block allocate_block() - { - if (!this->take_from_cache(used_)) -@@ -411,7 +411,7 @@ namespace foonathan - /// \returns The size of the next memory block, - /// i.e. of the next call to \ref allocate_block(). - /// If there are blocks in the cache, returns size of the next one. -- /// Otherwise forwards to the \concept{concept_blockallocator,BlockAllocator} and subtracts an implementation offset. -+ /// Otherwise forwards to the BlockAllocator and subtracts an implementation offset. - std::size_t next_block_size() const noexcept - { - return this->cache_empty() ? -@@ -420,7 +420,7 @@ namespace foonathan - this->cached_block_size(); - } - -- /// \returns A reference of the \concept{concept_blockallocator,BlockAllocator} object. -+ /// \returns A reference of the BlockAllocator object. - /// \requires It is undefined behavior to move this allocator out into another object. - allocator_type& get_allocator() noexcept - { -@@ -438,7 +438,7 @@ namespace foonathan - extern template class memory_arena; - #endif - -- /// A \concept{concept_blockallocator,BlockAllocator} that uses a given \concept{concept_rawallocator,RawAllocator} for allocating the blocks. -+ /// A BlockAllocator that uses a given RawAllocator for allocating the blocks. - /// It calls the \c allocate_array() function with a node of size \c 1 and maximum alignment on the used allocator for the block allocation. - /// The size of the next memory block will grow by a given factor after each allocation, - /// allowing an amortized constant allocation time in the higher level allocator. -@@ -466,7 +466,7 @@ namespace foonathan - - /// \effects Allocates a new memory block and increases the block size for the next allocation. - /// \returns The new \ref memory_block. -- /// \throws Anything thrown by the \c allocate_array() function of the \concept{concept_rawallocator,RawAllocator}. -+ /// \throws Anything thrown by the \c allocate_array() function of the RawAllocator. - memory_block allocate_block() - { - auto memory = -@@ -491,7 +491,7 @@ namespace foonathan - return block_size_; - } - -- /// \returns A reference to the used \concept{concept_rawallocator,RawAllocator} object. -+ /// \returns A reference to the used RawAllocator object. - allocator_type& get_allocator() noexcept - { - return *this; -@@ -519,9 +519,9 @@ namespace foonathan - extern template class memory_arena, false>; - #endif - -- /// A \concept{concept_blockallocator,BlockAllocator} that allows only one block allocation. -+ /// A BlockAllocator that allows only one block allocation. - /// It can be used to prevent higher-level allocators from expanding. -- /// The one block allocation is performed through the \c allocate_array() function of the given \concept{concept_rawallocator,RawAllocator}. -+ /// The one block allocation is performed through the \c allocate_array() function of the given RawAllocator. - /// \ingroup memory_adapter - template - class fixed_block_allocator : FOONATHAN_EBO(allocator_traits::allocator_type) -@@ -541,7 +541,7 @@ namespace foonathan - - /// \effects Allocates a new memory block or throws an exception if there was already one allocation. - /// \returns The new \ref memory_block. -- /// \throws Anything thrown by the \c allocate_array() function of the \concept{concept_rawallocator,RawAllocator} or \ref out_of_memory if this is not the first call. -+ /// \throws Anything thrown by the \c allocate_array() function of the RawAllocator or \ref out_of_memory if this is not the first call. - memory_block allocate_block() - { - if (block_size_) -@@ -572,7 +572,7 @@ namespace foonathan - return block_size_; - } - -- /// \returns A reference to the used \concept{concept_rawallocator,RawAllocator} object. -+ /// \returns A reference to the used RawAllocator object. - allocator_type& get_allocator() noexcept - { - return *this; -@@ -613,9 +613,9 @@ namespace foonathan - } - } // namespace detail - -- /// Takes either a \concept{concept_blockallocator,BlockAllocator} or a \concept{concept_rawallocator,RawAllocator}. -- /// In the first case simply aliases the type unchanged, in the second to \ref growing_block_allocator (or the template in `BlockAllocator`) with the \concept{concept_rawallocator,RawAllocator}. -- /// Using this allows passing normal \concept{concept_rawallocator,RawAllocators} as \concept{concept_blockallocator,BlockAllocators}. -+ /// Takes either a BlockAllocator or a RawAllocator. -+ /// In the first case simply aliases the type unchanged, in the second to \ref growing_block_allocator (or the template in `BlockAllocator`) with the RawAllocator. -+ /// Using this allows passing normal RawAllocators as BlockAllocators. - /// \ingroup memory_core - template class BlockAllocator = detail::default_block_wrapper> -@@ -625,8 +625,8 @@ namespace foonathan - BlockAllocator>::type); - - /// @{ -- /// Helper function make a \concept{concept_blockallocator,BlockAllocator}. -- /// \returns A \concept{concept_blockallocator,BlockAllocator} of the given type created with the given arguments. -+ /// Helper function make a BlockAllocator. -+ /// \returns A BlockAllocator of the given type created with the given arguments. - /// \requires Same requirements as the constructor. - /// \ingroup memory_core - template -diff --git a/include/foonathan/memory/memory_pool.hpp b/include/foonathan/memory/memory_pool.hpp -index 7e833a6e55ee3fb4315b693303a9252a494426f1..3ac5fe7a826d2ee2a58182a0630f82e816c364e6 100644 ---- a/include/foonathan/memory/memory_pool.hpp -+++ b/include/foonathan/memory/memory_pool.hpp -@@ -32,7 +32,7 @@ namespace foonathan - }; - } // namespace detail - -- /// A stateful \concept{concept_rawallocator,RawAllocator} that manages \concept{concept_node,nodes} of fixed size. -+ /// A stateful RawAllocator that manages nodes of fixed size. - /// It uses a \ref memory_arena with a given \c BlockOrRawAllocator defaulting to \ref growing_block_allocator, - /// subdivides them in small nodes of given size and puts them onto a free list. - /// Allocation and deallocation simply remove or add nodes from this list and are thus fast. -@@ -57,8 +57,8 @@ namespace foonathan - static constexpr std::size_t min_node_size = - FOONATHAN_IMPL_DEFINED(free_list::min_element_size); - -- /// \returns The minimum block size required for certain number of \concept{concept_node,node}. -- /// \requires \c node_size must be a valid \concept{concept_node,node size} -+ /// \returns The minimum block size required for certain number of node. -+ /// \requires \c node_size must be a valid node size - /// and \c number_of_nodes must be a non-zero value. - /// \note MSVC's implementation of \c std::list for example is never empty and always allocates proxy nodes. - /// To get enough memory for \c N elements of a list, \c number_of_nodes needs to include the proxy count in addition to \c N. -@@ -69,12 +69,12 @@ namespace foonathan - + free_list::min_block_size(node_size, number_of_nodes); - } - -- /// \effects Creates it by specifying the size each \concept{concept_node,node} will have, -- /// the initial block size for the arena and other constructor arguments for the \concept{concept_blockallocator,BlockAllocator}. -+ /// \effects Creates it by specifying the size each node will have, -+ /// the initial block size for the arena and other constructor arguments for the BlockAllocator. - /// If the \c node_size is less than the \c min_node_size, the \c min_node_size will be the actual node size. -- /// It will allocate an initial memory block with given size from the \concept{concept_blockallocator,BlockAllocator} -+ /// It will allocate an initial memory block with given size from the BlockAllocator - /// and puts it onto the free list. -- /// \requires \c node_size must be a valid \concept{concept_node,node size} -+ /// \requires \c node_size must be a valid node size - /// and \c block_size must be at least \c min_block_size(node_size, 1). - template - memory_pool(std::size_t node_size, std::size_t block_size, Args&&... args) -@@ -84,7 +84,7 @@ namespace foonathan - } - - /// \effects Destroys the \ref memory_pool by returning all memory blocks, -- /// regardless of properly deallocated back to the \concept{concept_blockallocator,BlockAllocator}. -+ /// regardless of properly deallocated back to the BlockAllocator. - ~memory_pool() noexcept {} - - /// @{ -@@ -108,12 +108,12 @@ namespace foonathan - } - /// @} - -- /// \effects Allocates a single \concept{concept_node,node} by removing it from the free list. -+ /// \effects Allocates a single node by removing it from the free list. - /// If the free list is empty, a new memory block will be allocated from the arena and put onto it. - /// The new block size will be \ref next_capacity() big. - /// \returns A node of size \ref node_size() suitable aligned, - /// i.e. suitable for any type where sizeof(T) < node_size(). -- /// \throws Anything thrown by the used \concept{concept_blockallocator,BlockAllocator}'s allocation function if a growth is needed. -+ /// \throws Anything thrown by the used BlockAllocator's allocation function if a growth is needed. - void* allocate_node() - { - if (free_list_.empty()) -@@ -122,7 +122,7 @@ namespace foonathan - return free_list_.allocate(); - } - -- /// \effects Allocates a single \concept{concept_node,node} similar to \ref allocate_node(). -+ /// \effects Allocates a single node similar to \ref allocate_node(). - /// But if the free list is empty, a new block will *not* be allocated. - /// \returns A suitable aligned node of size \ref node_size() or `nullptr`. - void* try_allocate_node() noexcept -@@ -130,13 +130,13 @@ namespace foonathan - return free_list_.empty() ? nullptr : free_list_.allocate(); - } - -- /// \effects Allocates an \concept{concept_array,array} of nodes by searching for \c n continuous nodes on the list and removing them. -+ /// \effects Allocates an array of nodes by searching for \c n continuous nodes on the list and removing them. - /// Depending on the \c PoolType this can be a slow operation or not allowed at all. - /// This can sometimes lead to a growth, even if technically there is enough continuous memory on the free list. - /// \returns An array of \c n nodes of size \ref node_size() suitable aligned. -- /// \throws Anything thrown by the used \concept{concept_blockallocator,BlockAllocator}'s allocation function if a growth is needed, -+ /// \throws Anything thrown by the used BlockAllocator's allocation function if a growth is needed, - /// or \ref bad_array_size if n * node_size() is too big. -- /// \requires \c n must be valid \concept{concept_array,array count}. -+ /// \requires \c n must be valid array count. - void* allocate_array(std::size_t n) - { - detail::check_allocation_size( -@@ -145,7 +145,7 @@ namespace foonathan - return allocate_array(n, node_size()); - } - -- /// \effects Allocates an \concept{concept_array,array} of nodes similar to \ref allocate_array(). -+ /// \effects Allocates an array of nodes similar to \ref allocate_array(). - /// But it will never allocate a new memory block. - /// \returns An array of \c n nodes of size \ref node_size() suitable aligned - /// or `nullptr`. -@@ -154,7 +154,7 @@ namespace foonathan - return try_allocate_array(n, node_size()); - } - -- /// \effects Deallocates a single \concept{concept_node,node} by putting it back onto the free list. -+ /// \effects Deallocates a single node by putting it back onto the free list. - /// \requires \c ptr must be a result from a previous call to \ref allocate_node() on the same free list, - /// i.e. either this allocator object or a new object created by moving this to it. - void deallocate_node(void* ptr) noexcept -@@ -162,7 +162,7 @@ namespace foonathan - free_list_.deallocate(ptr); - } - -- /// \effects Deallocates a single \concept{concept_node,node} but it does not be a result of a previous call to \ref allocate_node(). -+ /// \effects Deallocates a single node but it does not be a result of a previous call to \ref allocate_node(). - /// \returns `true` if the node could be deallocated, `false` otherwise. - /// \note Some free list implementations can deallocate any memory, - /// doesn't matter where it is coming from. -@@ -174,7 +174,7 @@ namespace foonathan - return true; - } - -- /// \effects Deallocates an \concept{concept_array,array} by putting it back onto the free list. -+ /// \effects Deallocates an array by putting it back onto the free list. - /// \requires \c ptr must be a result from a previous call to \ref allocate_array() with the same \c n on the same free list, - /// i.e. either this allocator object or a new object created by moving this to it. - void deallocate_array(void* ptr, std::size_t n) noexcept -@@ -183,7 +183,7 @@ namespace foonathan - free_list_.deallocate(ptr, n * node_size()); - } - -- /// \effects Deallocates an \concept{concept_array,array} but it does not be a result of a previous call to \ref allocate_array(). -+ /// \effects Deallocates an array but it does not be a result of a previous call to \ref allocate_array(). - /// \returns `true` if the node could be deallocated, `false` otherwise. - /// \note Some free list implementations can deallocate any memory, - /// doesn't matter where it is coming from. -@@ -192,7 +192,7 @@ namespace foonathan - return try_deallocate_array(ptr, n, node_size()); - } - -- /// \returns The size of each \concept{concept_node,node} in the pool, -+ /// \returns The size of each node in the pool, - /// this is either the same value as in the constructor or \c min_node_size if the value was too small. - std::size_t node_size() const noexcept - { -@@ -215,7 +215,7 @@ namespace foonathan - return free_list_.usable_size(arena_.next_block_size()); - } - -- /// \returns A reference to the \concept{concept_blockallocator,BlockAllocator} used for managing the arena. -+ /// \returns A reference to the BlockAllocator used for managing the arena. - /// \requires It is undefined behavior to move this allocator out into another object. - allocator_type& get_allocator() noexcept - { -@@ -306,7 +306,7 @@ namespace foonathan - /// \effects Forwards to \ref memory_pool::allocate_array() - /// with the number of nodes adjusted to be the minimum, - /// i.e. when the \c size is less than the \ref memory_pool::node_size(). -- /// \returns A \concept{concept_array,array} with specified properties. -+ /// \returns A array with specified properties. - /// \requires The \ref memory_pool has to support array allocations. - /// \throws Anything thrown by the pool allocation function. - static void* allocate_array(allocator_type& state, std::size_t count, std::size_t size, -@@ -382,7 +382,7 @@ namespace foonathan - /// \effects Forwards to \ref memory_pool::try_allocate_array() - /// with the number of nodes adjusted to be the minimum, - /// if the \c size is less than the \ref memory_pool::node_size(). -- /// \returns A \concept{concept_array,array} with specified properties -+ /// \returns A array with specified properties - /// or `nullptr` if it was unable to allocate. - static void* try_allocate_array(allocator_type& state, std::size_t count, - std::size_t size, std::size_t alignment) noexcept -diff --git a/include/foonathan/memory/memory_pool_collection.hpp b/include/foonathan/memory/memory_pool_collection.hpp -index 5467efe6c865a49563aa877d417641e6b1c840e9..2951a560c29771ba45c0fce501eb17baf2430048 100644 ---- a/include/foonathan/memory/memory_pool_collection.hpp -+++ b/include/foonathan/memory/memory_pool_collection.hpp -@@ -49,11 +49,11 @@ namespace foonathan - using type = detail::log2_access_policy; - }; - -- /// A stateful \concept{concept_rawallocator,RawAllocator} that behaves as a collection of multiple \ref memory_pool objects. -+ /// A stateful RawAllocator that behaves as a collection of multiple \ref memory_pool objects. - /// It maintains a list of multiple free lists, whose types are controlled via the \c PoolType tags defined in \ref memory_pool_type.hpp, - /// each of a different size as defined in the \c BucketDistribution (\ref identity_buckets or \ref log2_buckets). - /// Allocating a node of given size will use the appropriate free list.
-- /// This allocator is ideal for \concept{concept_node,node} allocations in any order but with a predefined set of sizes, -+ /// This allocator is ideal for node allocations in any order but with a predefined set of sizes, - /// not only one size like \ref memory_pool. - /// \ingroup memory_allocator - template - memory_pool_collection(std::size_t max_node_size, std::size_t block_size, - Args&&... args) -@@ -87,7 +87,7 @@ namespace foonathan - } - - /// \effects Destroys the \ref memory_pool_collection by returning all memory blocks, -- /// regardless of properly deallocated back to the \concept{concept_blockallocator,BlockAllocator}. -+ /// regardless of properly deallocated back to the BlockAllocator. - ~memory_pool_collection() noexcept = default; - - /// @{ -@@ -113,16 +113,16 @@ namespace foonathan - } - /// @} - -- /// \effects Allocates a \concept{concept_node,node} of given size. -+ /// \effects Allocates a node of given size. - /// It first finds the appropriate free list as defined in the \c BucketDistribution. - /// If it is empty, it will use an implementation defined amount of memory from the arena - /// and inserts it in it. -- /// If the arena is empty too, it will request a new memory block from the \concept{concept_blockallocator,BlockAllocator} -+ /// If the arena is empty too, it will request a new memory block from the BlockAllocator - /// of size \ref next_capacity() and puts part of it onto this free list. - /// Then it removes a node from it. -- /// \returns A \concept{concept_node,node} of given size suitable aligned, -+ /// \returns A node of given size suitable aligned, - /// i.e. suitable for any type where sizeof(T) < node_size. -- /// \throws Anything thrown by the \concept{concept_blockallocator,BlockAllocator} if a growth is needed or a \ref bad_node_size exception if the node size is too big. -+ /// \throws Anything thrown by the BlockAllocator if a growth is needed or a \ref bad_node_size exception if the node size is too big. - void* allocate_node(std::size_t node_size) - { - detail::check_allocation_size( -@@ -139,10 +139,10 @@ namespace foonathan - return mem; - } - -- /// \effects Allocates a \concept{concept_node,node} of given size. -+ /// \effects Allocates a node of given size. - /// It is similar to \ref allocate_node() but will return `nullptr` on any failure, - /// instead of growing the arnea and possibly throwing. -- /// \returns A \concept{concept_node,node} of given size suitable aligned -+ /// \returns A node of given size suitable aligned - /// or `nullptr` in case of failure. - void* try_allocate_node(std::size_t node_size) noexcept - { -@@ -158,15 +158,15 @@ namespace foonathan - return pool.allocate(); - } - -- /// \effects Allocates an \concept{concept_array,array} of nodes by searching for \c n continuous nodes on the appropriate free list and removing them. -+ /// \effects Allocates an array of nodes by searching for \c n continuous nodes on the appropriate free list and removing them. - /// Depending on the \c PoolType this can be a slow operation or not allowed at all. - /// This can sometimes lead to a growth on the free list, even if technically there is enough continuous memory on the free list. - /// Otherwise has the same behavior as \ref allocate_node(). - /// \returns An array of \c n nodes of size \c node_size suitable aligned. -- /// \throws Anything thrown by the used \concept{concept_blockallocator,BlockAllocator}'s allocation function if a growth is needed, -+ /// \throws Anything thrown by the used BlockAllocator's allocation function if a growth is needed, - /// or a \ref bad_allocation_size exception. -- /// \requires \c count must be valid \concept{concept_array,array count} and -- /// \c node_size must be valid \concept{concept_node,node size}. -+ /// \requires \c count must be valid array count and -+ /// \c node_size must be valid node size. - void* allocate_array(std::size_t count, std::size_t node_size) - { - detail::check_allocation_size( -@@ -202,10 +202,10 @@ namespace foonathan - return mem; - } - -- /// \effects Allocates a \concept{concept_array,array} of given size. -+ /// \effects Allocates a array of given size. - /// It is similar to \ref allocate_node() but will return `nullptr` on any failure, - /// instead of growing the arnea and possibly throwing. -- /// \returns A \concept{concept_array,array} of given size suitable aligned -+ /// \returns A array of given size suitable aligned - /// or `nullptr` in case of failure. - void* try_allocate_array(std::size_t count, std::size_t node_size) noexcept - { -@@ -221,7 +221,7 @@ namespace foonathan - return pool.allocate(count * node_size); - } - -- /// \effects Deallocates a \concept{concept_node,node} by putting it back onto the appropriate free list. -+ /// \effects Deallocates a node by putting it back onto the appropriate free list. - /// \requires \c ptr must be a result from a previous call to \ref allocate_node() with the same size on the same free list, - /// i.e. either this allocator object or a new object created by moving this to it. - void deallocate_node(void* ptr, std::size_t node_size) noexcept -@@ -229,7 +229,7 @@ namespace foonathan - pools_.get(node_size).deallocate(ptr); - } - -- /// \effects Deallocates a \concept{concept_node,node} similar to \ref deallocate_node(). -+ /// \effects Deallocates a node similar to \ref deallocate_node(). - /// But it checks if it can deallocate this memory. - /// \returns `true` if the node could be deallocated, - /// `false` otherwise. -@@ -241,7 +241,7 @@ namespace foonathan - return true; - } - -- /// \effects Deallocates an \concept{concept_array,array} by putting it back onto the free list. -+ /// \effects Deallocates an array by putting it back onto the free list. - /// \requires \c ptr must be a result from a previous call to \ref allocate_array() with the same sizes on the same free list, - /// i.e. either this allocator object or a new object created by moving this to it. - void deallocate_array(void* ptr, std::size_t count, std::size_t node_size) noexcept -@@ -249,7 +249,7 @@ namespace foonathan - pools_.get(node_size).deallocate(ptr, count * node_size); - } - -- /// \effects Deallocates a \concept{concept_array,array} similar to \ref deallocate_array(). -+ /// \effects Deallocates a array similar to \ref deallocate_array(). - /// But it checks if it can deallocate this memory. - /// \returns `true` if the array could be deallocated, - /// `false` otherwise. -@@ -263,10 +263,10 @@ namespace foonathan - - /// \effects Inserts more memory on the free list for nodes of given size. - /// It will try to put \c capacity_left bytes from the arena onto the free list defined over the \c BucketDistribution, -- /// if the arena is empty, a new memory block is requested from the \concept{concept_blockallocator,BlockAllocator} -+ /// if the arena is empty, a new memory block is requested from the BlockAllocator - /// and it will be used. -- /// \throws Anything thrown by the \concept{concept_blockallocator,BlockAllocator} if a growth is needed. -- /// \requires \c node_size must be valid \concept{concept_node,node size} less than or equal to \ref max_node_size(), -+ /// \throws Anything thrown by the BlockAllocator if a growth is needed. -+ /// \requires \c node_size must be valid node size less than or equal to \ref max_node_size(), - /// \c capacity_left must be less than \ref next_capacity(). - void reserve(std::size_t node_size, std::size_t capacity) - { -@@ -294,7 +294,7 @@ namespace foonathan - - /// \returns The amount of memory available in the arena not inside the free lists. - /// This is the number of bytes that can be inserted into the free lists -- /// without requesting more memory from the \concept{concept_blockallocator,BlockAllocator}. -+ /// without requesting more memory from the BlockAllocator. - /// \note Array allocations may lead to a growth even if the capacity is big enough. - std::size_t capacity_left() const noexcept - { -@@ -309,7 +309,7 @@ namespace foonathan - return arena_.next_block_size(); - } - -- /// \returns A reference to the \concept{concept_blockallocator,BlockAllocator} used for managing the arena. -+ /// \returns A reference to the BlockAllocator used for managing the arena. - /// \requires It is undefined behavior to move this allocator out into another object. - allocator_type& get_allocator() noexcept - { -diff --git a/include/foonathan/memory/memory_resource_adapter.hpp b/include/foonathan/memory/memory_resource_adapter.hpp -index cf58eed1f0134c5236ae20be4f095bb31244a4a1..41135bc55bedc58f4d496b0d3047b2ec5778ac18 100644 ---- a/include/foonathan/memory/memory_resource_adapter.hpp -+++ b/include/foonathan/memory/memory_resource_adapter.hpp -@@ -90,7 +90,7 @@ namespace foonathan - /// \ingroup memory_adapter - FOONATHAN_ALIAS_TEMPLATE(memory_resource, foonathan_memory_pmr::memory_resource); - -- /// Wraps a \concept{concept_rawallocator,RawAllocator} and makes it a \ref memory_resource. -+ /// Wraps a RawAllocator and makes it a \ref memory_resource. - /// \ingroup memory_adapter - template - class memory_resource_adapter -@@ -124,7 +124,7 @@ namespace foonathan - - /// \effects Allocates raw memory with given size and alignment. - /// It forwards to \c allocate_node() or \c allocate_array() depending on the size. -- /// \returns The new memory as returned by the \concept{concept_rawallocator,RawAllocator}. -+ /// \returns The new memory as returned by the RawAllocator. - /// \throws Anything thrown by the allocation function. - void* do_allocate(std::size_t bytes, std::size_t alignment) override - { -@@ -162,7 +162,7 @@ namespace foonathan - } - }; - -- /// Wraps a \ref memory_resource and makes it a \concept{concept_rawallocator,RawAllocator}. -+ /// Wraps a \ref memory_resource and makes it a RawAllocator. - /// \ingroup memory_adapter - class memory_resource_allocator - { -diff --git a/include/foonathan/memory/memory_stack.hpp b/include/foonathan/memory/memory_stack.hpp -index dc9f1226ab504546e06d471ac48bee4a1b50fcda..7f0eb56f9e628ab2e7324306a08b17d778d176cb 100644 ---- a/include/foonathan/memory/memory_stack.hpp -+++ b/include/foonathan/memory/memory_stack.hpp -@@ -92,7 +92,7 @@ namespace foonathan - }; - } // namespace detail - -- /// A stateful \concept{concept_rawallocator,RawAllocator} that provides stack-like (LIFO) allocations. -+ /// A stateful RawAllocator that provides stack-like (LIFO) allocations. - /// It uses a \ref memory_arena with a given \c BlockOrRawAllocator defaulting to \ref growing_block_allocator to allocate huge blocks - /// and saves a marker to the current top. - /// Allocation simply moves this marker by the appropriate number of bytes and returns the pointer at the old marker position, -@@ -116,7 +116,7 @@ namespace foonathan - return detail::memory_block_stack::implementation_offset() + byte_size; - } - -- /// \effects Creates it with a given initial block size and and other constructor arguments for the \concept{concept_blockallocator,BlockAllocator}. -+ /// \effects Creates it with a given initial block size and and other constructor arguments for the BlockAllocator. - /// It will allocate the first block and sets the top to its beginning. - /// \requires \c block_size must be at least \c min_block_size(1). - template -@@ -129,10 +129,10 @@ namespace foonathan - /// \effects Allocates a memory block of given size and alignment. - /// It simply moves the top marker. - /// If there is not enough space on the current memory block, -- /// a new one will be allocated by the \concept{concept_blockallocator,BlockAllocator} or taken from a cache -+ /// a new one will be allocated by the BlockAllocator or taken from a cache - /// and used for the allocation. -- /// \returns A \concept{concept_node,node} with given size and alignment. -- /// \throws Anything thrown by the \concept{concept_blockallocator,BlockAllocator} on growth -+ /// \returns A node with given size and alignment. -+ /// \throws Anything thrown by the BlockAllocator on growth - /// or \ref bad_allocation_size if \c size is too big. - /// \requires \c size and \c alignment must be valid. - void* allocate(std::size_t size, std::size_t alignment) -@@ -160,7 +160,7 @@ namespace foonathan - /// \effects Allocates a memory block of given size and alignment, - /// similar to \ref allocate(). - /// But it does not attempt a growth if the arena is empty. -- /// \returns A \concept{concept_node,node} with given size and alignment -+ /// \returns A node with given size and alignment - /// or `nullptr` if there wasn't enough memory available. - void* try_allocate(std::size_t size, std::size_t alignment) noexcept - { -@@ -221,7 +221,7 @@ namespace foonathan - } - } - -- /// \effects \ref unwind() does not actually do any deallocation of blocks on the \concept{concept_blockallocator,BlockAllocator}, -+ /// \effects \ref unwind() does not actually do any deallocation of blocks on the BlockAllocator, - /// unused memory is stored in a cache for later reuse. - /// This function clears that cache. - void shrink_to_fit() noexcept -@@ -231,7 +231,7 @@ namespace foonathan - - /// \returns The amount of memory remaining in the current block. - /// This is the number of bytes that are available for allocation -- /// before the cache or \concept{concept_blockallocator,BlockAllocator} needs to be used. -+ /// before the cache or BlockAllocator needs to be used. - std::size_t capacity_left() const noexcept - { - return std::size_t(block_end() - stack_.top()); -@@ -246,7 +246,7 @@ namespace foonathan - return arena_.next_block_size(); - } - -- /// \returns A reference to the \concept{concept_blockallocator,BlockAllocator} used for managing the arena. -+ /// \returns A reference to the BlockAllocator used for managing the arena. - /// \requires It is undefined behavior to move this allocator out into another object. - allocator_type& get_allocator() noexcept - { -diff --git a/include/foonathan/memory/new_allocator.hpp b/include/foonathan/memory/new_allocator.hpp -index 5d11038ae6fce0379c7aeddd470ea1ad4744f5b7..1d0dbe9ca584ba844dfa80b367168dda8e992471 100644 ---- a/include/foonathan/memory/new_allocator.hpp -+++ b/include/foonathan/memory/new_allocator.hpp -@@ -37,7 +37,7 @@ namespace foonathan - new_alloator_leak_checker) - } // namespace detail - -- /// A stateless \concept{concept_rawallocator,RawAllocator} that allocates memory using (nothrow) operator new. -+ /// A stateless RawAllocator that allocates memory using (nothrow) operator new. - /// If the operator returns \c nullptr, it behaves like \c new and loops calling \c std::new_handler, - /// but instead of throwing a \c std::bad_alloc exception, it throws \ref out_of_memory. - /// \ingroup memory_allocator -diff --git a/include/foonathan/memory/segregator.hpp b/include/foonathan/memory/segregator.hpp -index 75dad5ebbb795b91b919c2e3ac72de396a77c88e..883fd8ce723d0fcf91aebc2ff933773f237061fe 100644 ---- a/include/foonathan/memory/segregator.hpp -+++ b/include/foonathan/memory/segregator.hpp -@@ -17,7 +17,7 @@ namespace foonathan - { - namespace memory - { -- /// A \concept{concept_segregatable,Segregatable} that allocates until a maximum size. -+ /// A Segregatable that allocates until a maximum size. - /// \ingroup memory_adapter - template - class threshold_segregatable : FOONATHAN_EBO(allocator_traits::allocator_type) -@@ -76,7 +76,7 @@ namespace foonathan - std::forward(alloc)); - } - -- /// A composable \concept{concept_rawallocator,RawAllocator} that will always fail. -+ /// A composable RawAllocator that will always fail. - /// This is useful for compositioning or as last resort in \ref binary_segregator. - /// \ingroup memory_allocator - class null_allocator -@@ -116,7 +116,7 @@ namespace foonathan - } - }; - -- /// A \concept{concept_rawallocator,RawAllocator} that either uses the \concept{concept_segregatable,Segregatable} or the other `RawAllocator`. -+ /// A RawAllocator that either uses the Segregatable or the other `RawAllocator`. - /// It is a faster alternative to \ref fallback_allocator that doesn't require a composable allocator - /// and decides about the allocator to use purely with the `Segregatable` based on size and alignment. - /// \ingroup memory_adapter -@@ -133,8 +133,8 @@ namespace foonathan - using segregatable_allocator_type = typename segregatable::allocator_type; - using fallback_allocator_type = typename allocator_traits::allocator_type; - -- /// \effects Creates it by giving the \concept{concept_segregatable,Segregatable} -- /// and the \concept{concept_rawallocator,RawAllocator}. -+ /// \effects Creates it by giving the Segregatable -+ /// and the RawAllocator. - explicit binary_segregator(segregatable s, - fallback_allocator_type fallback = fallback_allocator_type()) - : detail::ebo_storage<1, fallback_allocator_type>(detail::move(fallback)), -@@ -143,7 +143,7 @@ namespace foonathan - } - - /// @{ -- /// \effects Uses the \concept{concept_segregatable,Segregatable} to decide which allocator to use. -+ /// \effects Uses the Segregatable to decide which allocator to use. - /// Then forwards to the chosen allocator. - void* allocate_node(std::size_t size, std::size_t alignment) - { -@@ -223,7 +223,7 @@ namespace foonathan - - /// @{ - /// \returns A reference to the fallback allocator. -- /// It will be used if the \concept{concept_segregator,Segregator} doesn't want the alloction. -+ /// It will be used if the Segregator doesn't want the alloction. - fallback_allocator_type& get_fallback_allocator() noexcept - { - return detail::ebo_storage<1, fallback_allocator_type>::get(); -@@ -366,10 +366,10 @@ namespace foonathan - } // namespace detail - - /// Creates multiple nested \ref binary_segregator. -- /// If you pass one type, it must be a \concept{concept_segregatable,Segregatable}. -+ /// If you pass one type, it must be a Segregatable. - /// Then the result is a \ref binary_segregator with that `Segregatable` and \ref null_allocator as fallback. - /// If you pass two types, the first one must be a `Segregatable`, -- /// the second one a \concept{concept_rawallocator,RawAllocator}. -+ /// the second one a RawAllocator. - /// Then the result is a simple \ref binary_segregator with those arguments. - /// If you pass more than one, the last one must be a `RawAllocator` all others `Segregatable`, - /// the result is `binary_segregator>`. -@@ -388,7 +388,7 @@ namespace foonathan - return detail::make_segregator(std::forward(args)...); - } - -- /// The number of \concept{concept_segregatable,Segregatable} a \ref segregator has. -+ /// The number of Segregatable a \ref segregator has. - /// \relates segregator - template - struct segregator_size -@@ -396,13 +396,13 @@ namespace foonathan - static const std::size_t value = detail::fallback_type::size; - }; - -- /// The type of the `I`th \concept{concept_segregatable,Segregatable}. -+ /// The type of the `I`th Segregatable. - /// \relates segregator - template - using segregatable_allocator_type = typename detail::segregatable_type::type; - - /// @{ -- /// \returns The `I`th \concept{concept_segregatable,Segregatable}. -+ /// \returns The `I`th Segregatable. - /// \relates segregrator - template - auto get_segregatable_allocator(binary_segregator& s) -@@ -419,13 +419,13 @@ namespace foonathan - } - /// @} - -- /// The type of the final fallback \concept{concept_rawallocator,RawAllocator}. -+ /// The type of the final fallback RawAllocator. - /// \relates segregator - template - using fallback_allocator_type = typename detail::fallback_type::type; - - /// @{ -- /// \returns The final fallback \concept{concept_rawallocator,RawAllocator}. -+ /// \returns The final fallback RawAllocator. - /// \relates segregator - template - auto get_fallback_allocator(binary_segregator& s) -diff --git a/include/foonathan/memory/smart_ptr.hpp b/include/foonathan/memory/smart_ptr.hpp -index f8508a404e9476b449b7ed5853b0dcdd65630e2f..9747a5133314db6f88a3120bd18619b09dd7b971 100644 ---- a/include/foonathan/memory/smart_ptr.hpp -+++ b/include/foonathan/memory/smart_ptr.hpp -@@ -5,7 +5,7 @@ - #define FOONATHAN_MEMORY_SMART_PTR_HPP_INCLUDED - - /// \file --/// \c std::make_unique() / \c std::make_shared() replacement allocating memory through a \concept{concept_rawallocator,RawAllocator}. -+/// \c std::make_unique() / \c std::make_shared() replacement allocating memory through a RawAllocator. - /// \note Only available on a hosted implementation. - - #include "config.hpp" -@@ -85,7 +85,7 @@ namespace foonathan - } - } // namespace detail - -- /// A \c std::unique_ptr that deletes using a \concept{concept_rawallocator,RawAllocator}. -+ /// A \c std::unique_ptr that deletes using a RawAllocator. - /// - /// It is an alias template using \ref allocator_deleter as \c Deleter class. - /// \ingroup memory_adapter -@@ -93,7 +93,7 @@ namespace foonathan - FOONATHAN_ALIAS_TEMPLATE(unique_ptr, - std::unique_ptr>); - -- /// A \c std::unique_ptr that deletes using a \concept{concept_rawallocator,RawAllocator} and allows polymorphic types. -+ /// A \c std::unique_ptr that deletes using a RawAllocator and allows polymorphic types. - /// - /// It can only be created by converting a regular unique pointer to a pointer to a derived class, - /// and is meant to be used inside containers. -@@ -105,7 +105,7 @@ namespace foonathan - unique_base_ptr, - std::unique_ptr>); - -- /// Creates a \c std::unique_ptr using a \concept{concept_rawallocator,RawAllocator} for the allocation. -+ /// Creates a \c std::unique_ptr using a RawAllocator for the allocation. - /// \effects Allocates memory for the given type using the allocator - /// and creates a new object inside it passing the given arguments to its constructor. - /// \returns A \c std::unique_ptr owning that memory. -@@ -122,7 +122,7 @@ namespace foonathan - detail::forward(args)...); - } - -- /// Creates a \c std::unique_ptr using a type-erased \concept{concept_rawallocator,RawAllocator} for the allocation. -+ /// Creates a \c std::unique_ptr using a type-erased RawAllocator for the allocation. - /// It is the same as the other overload but stores the reference to the allocator type-erased inside the \c std::unique_ptr. - /// \effects Allocates memory for the given type using the allocator - /// and creates a new object inside it passing the given arguments to its constructor. -@@ -141,7 +141,7 @@ namespace foonathan - detail::forward(args)...); - } - -- /// Creates a \c std::unique_ptr owning an array using a \concept{concept_rawallocator,RawAllocator} for the allocation. -+ /// Creates a \c std::unique_ptr owning an array using a RawAllocator for the allocation. - /// \effects Allocates memory for an array of given size and value initializes each element inside of it. - /// \returns A \c std::unique_ptr owning that array. - /// \note If the allocator is stateful a reference to the \c RawAllocator will be stored inside the deleter, -@@ -158,7 +158,7 @@ namespace foonathan - detail::forward(alloc))); - } - -- /// Creates a \c std::unique_ptr owning an array using a type-erased \concept{concept_rawallocator,RawAllocator} for the allocation. -+ /// Creates a \c std::unique_ptr owning an array using a type-erased RawAllocator for the allocation. - /// It is the same as the other overload but stores the reference to the allocator type-erased inside the \c std::unique_ptr. - /// \effects Allocates memory for an array of given size and value initializes each element inside of it. - /// \returns A \c std::unique_ptr with a type-erased allocator reference owning that array. -@@ -177,7 +177,7 @@ namespace foonathan - alloc))); - } - -- /// Creates a \c std::shared_ptr using a \concept{concept_rawallocator,RawAllocator} for the allocation. -+ /// Creates a \c std::shared_ptr using a RawAllocator for the allocation. - /// It is similar to \c std::allocate_shared but uses a \c RawAllocator (and thus also supports any \c Allocator). - /// \effects Calls \ref std_allocator::make_std_allocator to wrap the allocator and forwards to \c std::allocate_shared. - /// \returns A \c std::shared_ptr created using \c std::allocate_shared. -diff --git a/include/foonathan/memory/static_allocator.hpp b/include/foonathan/memory/static_allocator.hpp -index 580fa2be8f5b1a291d1864558cb75328c4baff3f..472bdeb99fdbfc973e614ffbe6903a50a1193c70 100644 ---- a/include/foonathan/memory/static_allocator.hpp -+++ b/include/foonathan/memory/static_allocator.hpp -@@ -39,7 +39,7 @@ namespace foonathan - - struct allocator_info; - -- /// A stateful \concept{concept_rawallocator,RawAllocator} that uses a fixed sized storage for the allocations. -+ /// A stateful RawAllocator that uses a fixed sized storage for the allocations. - /// It works on a \ref static_allocator_storage and uses its memory for all allocations. - /// Deallocations are not supported, memory cannot be marked as freed.
- /// \note It is not allowed to share an \ref static_allocator_storage between multiple \ref static_allocator objects. -@@ -60,13 +60,13 @@ namespace foonathan - { - } - -- /// \effects A \concept{concept_rawallocator,RawAllocator} allocation function. -+ /// \effects A RawAllocator allocation function. - /// It uses the specified \ref static_allocator_storage. -- /// \returns A pointer to a \concept{concept_node,node}, it will never be \c nullptr. -+ /// \returns A pointer to a node, it will never be \c nullptr. - /// \throws An exception of type \ref out_of_memory or whatever is thrown by its handler if the storage is exhausted. - void* allocate_node(std::size_t size, std::size_t alignment); - -- /// \effects A \concept{concept_rawallocator,RawAllocator} deallocation function. -+ /// \effects A RawAllocator deallocation function. - /// It does nothing, deallocation is not supported by this allocator. - void deallocate_node(void*, std::size_t, std::size_t) noexcept {} - -@@ -96,7 +96,7 @@ namespace foonathan - - struct memory_block; - -- /// A \concept{concept_blockallocator,BlockAllocator} that allocates the blocks from a fixed size storage. -+ /// A BlockAllocator that allocates the blocks from a fixed size storage. - /// It works on a \ref static_allocator_storage and uses it for all allocations, - /// deallocations are only allowed in reversed order which is guaranteed by \ref memory_arena. - /// \note It is not allowed to share an \ref static_allocator_storage between multiple \ref static_allocator objects. -diff --git a/include/foonathan/memory/std_allocator.hpp b/include/foonathan/memory/std_allocator.hpp -index 33b2f5489b290f9cf3d3ad710373e2f982928f12..a465c7ad38d481e0cff93ea4f8892fd4dc58f920 100644 ---- a/include/foonathan/memory/std_allocator.hpp -+++ b/include/foonathan/memory/std_allocator.hpp -@@ -43,7 +43,7 @@ namespace foonathan - auto propagate_on_container_copy_assignment(min_concept) -> std::true_type; - } // namespace traits_detail - -- /// Controls the propagation of a \ref std_allocator for a certain \concept{concept_rawallocator,RawAllocator}. -+ /// Controls the propagation of a \ref std_allocator for a certain RawAllocator. - /// \ingroup memory_adapter - template - struct propagation_traits -@@ -67,7 +67,7 @@ namespace foonathan - } - }; - -- /// Wraps a \concept{concept_rawallocator,RawAllocator} and makes it a "normal" \c Allocator. -+ /// Wraps a RawAllocator and makes it a "normal" \c Allocator. - /// It allows using a \c RawAllocator anywhere a \c Allocator is required. - /// \ingroup memory_adapter - template -@@ -186,7 +186,7 @@ namespace foonathan - } - - //=== allocation/deallocation ===// -- /// \effects Allocates memory using the underlying \concept{concept_rawallocator,RawAllocator}. -+ /// \effects Allocates memory using the underlying RawAllocator. - /// If \c n is \c 1, it will call allocate_node(sizeof(T), alignof(T)), - /// otherwise allocate_array(n, sizeof(T), alignof(T)). - /// \returns A pointer to a memory block suitable for \c n objects of type \c T. -@@ -196,7 +196,7 @@ namespace foonathan - return static_cast(allocate_impl(is_any{}, n)); - } - -- /// \effects Deallcoates memory using the underlying \concept{concept_rawallocator,RawAllocator}. -+ /// \effects Deallcoates memory using the underlying RawAllocator. - /// It will forward to the deallocation function in the same way as in \ref allocate(). - /// \requires The pointer must come from a previous call to \ref allocate() with the same \c n on this object or any copy of it. - void deallocate(pointer p, size_type n) noexcept -@@ -341,7 +341,7 @@ namespace foonathan - return {detail::forward(allocator)}; - } - -- /// An alias template for \ref std_allocator using a type-erased \concept{concept_rawallocator,RawAllocator}. -+ /// An alias template for \ref std_allocator using a type-erased RawAllocator. - /// This is the same as using a \ref std_allocator with the tag type \ref any_allocator. - /// The implementation is optimized to call fewer virtual functions. - /// \ingroup memory_adapter -diff --git a/include/foonathan/memory/temporary_allocator.hpp b/include/foonathan/memory/temporary_allocator.hpp -index 135d250bc15ee074a22b3c210b541dcff98e6d83..d8f9f18795568462bbc27dba6581585c537f5742 100644 ---- a/include/foonathan/memory/temporary_allocator.hpp -+++ b/include/foonathan/memory/temporary_allocator.hpp -@@ -209,7 +209,7 @@ namespace foonathan - temporary_stack& get_temporary_stack( - std::size_t initial_size = temporary_stack_initializer::default_stack_size); - -- /// A stateful \concept{concept_rawallocator,RawAllocator} that handles temporary allocations. -+ /// A stateful RawAllocator that handles temporary allocations. - /// It works similar to \c alloca() but uses a seperate \ref memory_stack for the allocations, - /// instead of the actual program stack. - /// This avoids the stack overflow error and is portable, -diff --git a/include/foonathan/memory/threading.hpp b/include/foonathan/memory/threading.hpp -index 52b3998b2c7b7ee5c4b0def5857ddaf6f65e8435..7fadd8ae80b28a3ff2ae564fba4555d0d2745f63 100644 ---- a/include/foonathan/memory/threading.hpp -+++ b/include/foonathan/memory/threading.hpp -@@ -35,7 +35,7 @@ namespace foonathan - void unlock() noexcept {} - }; - -- /// Specifies whether or not a \concept{concept_rawallocator,RawAllocator} is thread safe as-is. -+ /// Specifies whether or not a RawAllocator is thread safe as-is. - /// This allows to use \ref no_mutex as an optimization. - /// Note that stateless allocators are implictly thread-safe. - /// Specialize it only for your own stateful allocators. -diff --git a/include/foonathan/memory/tracking.hpp b/include/foonathan/memory/tracking.hpp -index 222e6105bf35d884fa4e472f077ebf58a721894a..80d509af506b0b173238d2beb12570c9b9530090 100644 ---- a/include/foonathan/memory/tracking.hpp -+++ b/include/foonathan/memory/tracking.hpp -@@ -69,11 +69,11 @@ namespace foonathan - }; - } // namespace detail - -- /// A \concept{concept_blockallocator,BlockAllocator} adapter that tracks another allocator using a \concept{concept_tracker,tracker}. -- /// It wraps another \concept{concept_blockallocator,BlockAllocator} and calls the tracker function before forwarding to it. -- /// The class can then be used anywhere a \concept{concept_blockallocator,BlockAllocator} is required and the memory usage will be tracked.
-+ /// A BlockAllocator adapter that tracks another allocator using a tracker. -+ /// It wraps another BlockAllocator and calls the tracker function before forwarding to it. -+ /// The class can then be used anywhere a BlockAllocator is required and the memory usage will be tracked.
- /// It will only call the on_allocator_growth() and on_allocator_shrinking() tracking functions, -- /// since a \concept{concept_blockallocator,BlockAllocator} is normally used inside higher allocators only. -+ /// since a BlockAllocator is normally used inside higher allocators only. - /// \ingroup memory_adapter - template - class tracked_block_allocator -@@ -84,7 +84,7 @@ namespace foonathan - using tracker = Tracker; - - /// @{ -- /// \effects Creates it by giving it a \concept{concept_tracker,tracker} and the tracked \concept{concept_rawallocator,RawAllocator}. -+ /// \effects Creates it by giving it a tracker and the tracked RawAllocator. - /// It will embed both objects. - explicit tracked_block_allocator(tracker t = {}) noexcept : tracker(detail::move(t)) {} - -@@ -160,10 +160,10 @@ namespace foonathan - detail::deeply_tracked_block_allocator>); - -- /// A \concept{concept_rawallocator,RawAllocator} adapter that tracks another allocator using a \concept{concept_tracker,tracker}. -- /// It wraps another \concept{concept_rawallocator,RawAllocator} and calls the tracker function before forwarding to it. -- /// The class can then be used anywhere a \concept{concept_rawallocator,RawAllocator} is required and the memory usage will be tracked.
-- /// If the \concept{concept_rawallocator,RawAllocator} uses \ref deeply_tracked_block_allocator as \concept{concept_blockallocator,BlockAllocator}, -+ /// A RawAllocator adapter that tracks another allocator using a tracker. -+ /// It wraps another RawAllocator and calls the tracker function before forwarding to it. -+ /// The class can then be used anywhere a RawAllocator is required and the memory usage will be tracked.
-+ /// If the RawAllocator uses \ref deeply_tracked_block_allocator as BlockAllocator, - /// it will also track growth and shrinking of the allocator. - /// \ingroup memory_adapter - template -@@ -181,7 +181,7 @@ namespace foonathan - || !std::is_empty::value>; - - /// @{ -- /// \effects Creates it by giving it a \concept{concept_tracker,tracker} and the tracked \concept{concept_rawallocator,RawAllocator}. -+ /// \effects Creates it by giving it a tracker and the tracked RawAllocator. - /// It will embed both objects. - /// \note This will never call the Tracker::on_allocator_growth() function. - explicit tracked_allocator(tracker t = {}) noexcept -@@ -350,7 +350,7 @@ namespace foonathan - /// @} - }; - -- /// \effects Takes a \concept{concept_rawallocator,RawAllocator} and wraps it with a \concept{concept_tracker,tracker}. -+ /// \effects Takes a RawAllocator and wraps it with a tracker. - /// \returns A \ref tracked_allocator with the corresponding parameters forwarded to the constructor. - /// \relates tracked_allocator - template -@@ -403,16 +403,16 @@ namespace foonathan - RawAllocator, deeply_tracked_block_allocator_for>::type; - } // namespace detail - -- /// A \ref tracked_allocator that has rebound any \concept{concept_blockallocator,BlockAllocator} to the corresponding \ref deeply_tracked_block_allocator. -+ /// A \ref tracked_allocator that has rebound any BlockAllocator to the corresponding \ref deeply_tracked_block_allocator. - /// This makes it a deeply tracked allocator.
-- /// It replaces each template argument of the given \concept{concept_rawallocator,RawAllocator} for which \ref is_block_allocator or \ref is_raw_allocator is \c true with a \ref deeply_tracked_block_allocator. -+ /// It replaces each template argument of the given RawAllocator for which \ref is_block_allocator or \ref is_raw_allocator is \c true with a \ref deeply_tracked_block_allocator. - /// \ingroup memory_adapter - template - FOONATHAN_ALIAS_TEMPLATE( - deeply_tracked_allocator, - tracked_allocator>); - -- /// \effects Takes a \concept{concept_rawallocator,RawAllocator} and deeply wraps it with a \concept{concept_tracker,tracker}. -+ /// \effects Takes a RawAllocator and deeply wraps it with a tracker. - /// \returns A \ref deeply_tracked_allocator with the corresponding parameters forwarded to the constructor. - /// \relates deeply_tracked_allocator - template -diff --git a/include/foonathan/memory/virtual_memory.hpp b/include/foonathan/memory/virtual_memory.hpp -index 35f7ccd54fdda08c504696b0719d16ec27d6c9e9..c1d3cbc882bf29e023770c9b8699c655f4119a64 100644 ---- a/include/foonathan/memory/virtual_memory.hpp -+++ b/include/foonathan/memory/virtual_memory.hpp -@@ -76,7 +76,7 @@ namespace foonathan - /// \ingroup memory_allocator - void virtual_memory_decommit(void* memory, std::size_t no_pages) noexcept; - -- /// A stateless \concept{concept_rawallocator,RawAllocator} that allocates memory using the virtual memory allocation functions. -+ /// A stateless RawAllocator that allocates memory using the virtual memory allocation functions. - /// It does not prereserve any memory and will always reserve and commit combined. - /// \ingroup memory_allocator - class virtual_memory_allocator -@@ -94,17 +94,17 @@ namespace foonathan - return *this; - } - -- /// \effects A \concept{concept_rawallocator,RawAllocator} allocation function. -+ /// \effects A RawAllocator allocation function. - /// It uses \ref virtual_memory_reserve followed by \ref virtual_memory_commit for the allocation. - /// The number of pages allocated will be the minimum to hold \c size continuous bytes, - /// i.e. \c size will be rounded up to the next multiple. - /// If debug fences are activated, one additional page before and after the memory will be allocated. -- /// \returns A pointer to a \concept{concept_node,node}, it will never be \c nullptr. -+ /// \returns A pointer to a node, it will never be \c nullptr. - /// It will always be aligned on a fence boundary, regardless of the alignment parameter. - /// \throws An exception of type \ref out_of_memory or whatever is thrown by its handler if the allocation fails. - void* allocate_node(std::size_t size, std::size_t alignment); - -- /// \effects A \concept{concept_rawallocator,RawAllocator} deallocation function. -+ /// \effects A RawAllocator deallocation function. - /// It calls \ref virtual_memory_decommit followed by \ref virtual_memory_release for the deallocation. - void deallocate_node(void* node, std::size_t size, std::size_t alignment) noexcept; - -@@ -122,7 +122,7 @@ namespace foonathan - struct memory_block; - struct allocator_info; - -- /// A \concept{concept_blockallocator,BlockAllocator} that reserves virtual memory and commits it part by part. -+ /// A BlockAllocator that reserves virtual memory and commits it part by part. - /// It is similar to \ref memory_stack but does not support growing and uses virtual memory, - /// also meant for big blocks not small allocations. - /// \ingroup memory_allocator diff --git a/upstream_utils/memory_patches/0003-Fix-deprecation-warning-for-UDLs.patch b/upstream_utils/memory_patches/0003-Fix-deprecation-warning-for-UDLs.patch deleted file mode 100644 index c8bd3cd4a0..0000000000 --- a/upstream_utils/memory_patches/0003-Fix-deprecation-warning-for-UDLs.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tyler Veness -Date: Tue, 8 Apr 2025 15:30:06 -0700 -Subject: [PATCH 3/3] Fix deprecation warning for UDLs - ---- - include/foonathan/memory/memory_arena.hpp | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/include/foonathan/memory/memory_arena.hpp b/include/foonathan/memory/memory_arena.hpp -index eb969a677329b5b2d536f39f9a15817f040cf79f..d91f2a58cef56278cdb091daf34cebba7ec5b92c 100644 ---- a/include/foonathan/memory/memory_arena.hpp -+++ b/include/foonathan/memory/memory_arena.hpp -@@ -656,32 +656,32 @@ namespace foonathan - /// \returns The number of bytes `value` is in the given unit. - /// \ingroup memory_core - /// @{ -- constexpr std::size_t operator"" _KiB(unsigned long long value) noexcept -+ constexpr std::size_t operator""_KiB(unsigned long long value) noexcept - { - return std::size_t(value * 1024); - } - -- constexpr std::size_t operator"" _KB(unsigned long long value) noexcept -+ constexpr std::size_t operator""_KB(unsigned long long value) noexcept - { - return std::size_t(value * 1000); - } - -- constexpr std::size_t operator"" _MiB(unsigned long long value) noexcept -+ constexpr std::size_t operator""_MiB(unsigned long long value) noexcept - { - return std::size_t(value * 1024 * 1024); - } - -- constexpr std::size_t operator"" _MB(unsigned long long value) noexcept -+ constexpr std::size_t operator""_MB(unsigned long long value) noexcept - { - return std::size_t(value * 1000 * 1000); - } - -- constexpr std::size_t operator"" _GiB(unsigned long long value) noexcept -+ constexpr std::size_t operator""_GiB(unsigned long long value) noexcept - { - return std::size_t(value * 1024 * 1024 * 1024); - } - -- constexpr std::size_t operator"" _GB(unsigned long long value) noexcept -+ constexpr std::size_t operator""_GB(unsigned long long value) noexcept - { - return std::size_t(value * 1000 * 1000 * 1000); - } diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/MecanumControllerCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/MecanumControllerCommand.java index 56bcc8e851..65394cc0a6 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/MecanumControllerCommand.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/MecanumControllerCommand.java @@ -172,6 +172,8 @@ public class MecanumControllerCommand extends Command { * @param outputDriveVoltages A MecanumDriveMotorVoltages object containing the output motor * voltages. * @param requirements The subsystems to require. + * @deprecated Use {@link MecanumVoltagesConsumer} instead of {@code + * Consumer}. */ @Deprecated(since = "2025", forRemoval = true) public MecanumControllerCommand( diff --git a/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp b/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp index 6a9a4fbda6..986e1afc97 100644 --- a/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp +++ b/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp @@ -112,8 +112,8 @@ DifferentialDrive::WheelSpeeds DifferentialDrive::ArcadeDriveIK( // Square the inputs (while preserving the sign) to increase fine control // while permitting full power. if (squareInputs) { - xSpeed = std::copysign(xSpeed * xSpeed, xSpeed); - zRotation = std::copysign(zRotation * zRotation, zRotation); + xSpeed = CopySignPow(xSpeed, 2); + zRotation = CopySignPow(zRotation, 2); } double leftSpeed = xSpeed - zRotation; @@ -167,8 +167,8 @@ DifferentialDrive::WheelSpeeds DifferentialDrive::TankDriveIK( // Square the inputs (while preserving the sign) to increase fine control // while permitting full power. if (squareInputs) { - leftSpeed = std::copysign(leftSpeed * leftSpeed, leftSpeed); - rightSpeed = std::copysign(rightSpeed * rightSpeed, rightSpeed); + leftSpeed = CopySignPow(leftSpeed, 2); + rightSpeed = CopySignPow(rightSpeed, 2); } return {leftSpeed, rightSpeed}; diff --git a/wpilibc/src/main/native/include/frc/Notifier.h b/wpilibc/src/main/native/include/frc/Notifier.h index 53e980f474..2841be4834 100644 --- a/wpilibc/src/main/native/include/frc/Notifier.h +++ b/wpilibc/src/main/native/include/frc/Notifier.h @@ -102,7 +102,7 @@ class Notifier { * The user-provided callback should be written so that it completes before * the next time it's scheduled to run. * - * @param period Period after which to to call the callback starting one + * @param period Period after which to call the callback starting one * period after the call to this method. */ void StartPeriodic(units::second_t period); diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Notifier.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Notifier.java index b60b460431..e077440d7e 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Notifier.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Notifier.java @@ -192,8 +192,8 @@ public class Notifier implements AutoCloseable { *

The user-provided callback should be written so that it completes before the next time it's * scheduled to run. * - * @param period Period in seconds after which to to call the callback starting one period after - * the call to this method. + * @param period Period in seconds after which to call the callback starting one period after the + * call to this method. */ public void startPeriodic(double period) { m_processLock.lock(); diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Preferences.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Preferences.java index b1a6a35b0a..3e3889e747 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Preferences.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Preferences.java @@ -96,6 +96,15 @@ public final class Preferences { }); } + /** + * Gets the network table used for preferences entries. + * + * @return the network table used for preferences entries + */ + public static NetworkTable getNetworkTable() { + return m_table; + } + /** * Gets the preferences keys. * diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/drive/DifferentialDrive.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/drive/DifferentialDrive.java index 0e0c8211a5..b617a005d8 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/drive/DifferentialDrive.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/drive/DifferentialDrive.java @@ -260,8 +260,8 @@ public class DifferentialDrive extends RobotDriveBase implements Sendable, AutoC // Square the inputs (while preserving the sign) to increase fine control // while permitting full power. if (squareInputs) { - xSpeed = Math.copySign(xSpeed * xSpeed, xSpeed); - zRotation = Math.copySign(zRotation * zRotation, zRotation); + xSpeed = MathUtil.copySignPow(xSpeed, 2); + zRotation = MathUtil.copySignPow(zRotation, 2); } double leftSpeed = xSpeed - zRotation; @@ -335,8 +335,8 @@ public class DifferentialDrive extends RobotDriveBase implements Sendable, AutoC // Square the inputs (while preserving the sign) to increase fine control // while permitting full power. if (squareInputs) { - leftSpeed = Math.copySign(leftSpeed * leftSpeed, leftSpeed); - rightSpeed = Math.copySign(rightSpeed * rightSpeed, rightSpeed); + leftSpeed = MathUtil.copySignPow(leftSpeed, 2); + rightSpeed = MathUtil.copySignPow(rightSpeed, 2); } return new WheelSpeeds(leftSpeed, rightSpeed); diff --git a/wpilibj/src/test/java/edu/wpi/first/wpilibj/PreferencesTest.java b/wpilibj/src/test/java/edu/wpi/first/wpilibj/PreferencesTest.java index 21a27a2e8f..6375178ce8 100644 --- a/wpilibj/src/test/java/edu/wpi/first/wpilibj/PreferencesTest.java +++ b/wpilibj/src/test/java/edu/wpi/first/wpilibj/PreferencesTest.java @@ -91,6 +91,13 @@ class PreferencesTest { "Preferences was not empty! Preferences in table: " + Arrays.toString(keys.toArray())); } + @Test + void getNetworkTableTest() { + NetworkTable networkTable = Preferences.getNetworkTable(); + + assertEquals(m_table, networkTable); + } + @ParameterizedTest @MethodSource("defaultKeyProvider") void defaultKeysTest(String key) { diff --git a/wpimath/src/main/java/edu/wpi/first/math/MathUtil.java b/wpimath/src/main/java/edu/wpi/first/math/MathUtil.java index 1e374ec583..239a6a31fb 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/MathUtil.java +++ b/wpimath/src/main/java/edu/wpi/first/math/MathUtil.java @@ -107,6 +107,42 @@ public final class MathUtil { return applyDeadband(value, deadband, 1); } + /** + * Raises the input to the power of the given exponent while preserving its sign. + * + *

The function normalizes the input value to the range [0, 1] based on the maximum magnitude, + * raises it to the power of the exponent, then scales the result back to the original range and + * copying the sign. This keeps the value in the original range and gives consistent curve + * behavior regardless of the input value's scale. + * + *

This is useful for applying smoother or more aggressive control response curves (e.g. + * joystick input shaping). + * + * @param value The input value to transform. + * @param exponent The exponent to apply (e.g. 1.0 = linear, 2.0 = squared curve). Must be + * positive. + * @param maxMagnitude The maximum expected absolute value of input. Must be positive. + * @return The transformed value with the same sign and scaled to the input range. + */ + public static double copySignPow(double value, double exponent, double maxMagnitude) { + return Math.copySign(Math.pow(Math.abs(value) / maxMagnitude, exponent), value) * maxMagnitude; + } + + /** + * Raises the input to the power of the given exponent while preserving its sign. + * + *

This is useful for applying smoother or more aggressive control response curves (e.g. + * joystick input shaping). + * + * @param value The input value to transform. + * @param exponent The exponent to apply (e.g. 1.0 = linear, 2.0 = squared curve). Must be + * positive. + * @return The transformed value with the same sign. + */ + public static double copySignPow(double value, double exponent) { + return copySignPow(value, exponent, 1); + } + /** * Returns modulus of input. * diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java b/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java index 91ebab06c2..f72eab198c 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java @@ -189,6 +189,7 @@ public class ArmFeedforward implements ProtobufSerializable, StructSerializable * @param currentVelocity The current velocity setpoint in radians per second. * @param nextVelocity The next velocity setpoint in radians per second. * @return The computed feedforward in volts. + * @deprecated Use {@link #calculateWithVelocities(double, double, double)} instead. */ public double calculate(double currentAngle, double currentVelocity, double nextVelocity) { return ArmFeedforwardJNI.calculate( diff --git a/wpimath/src/main/java/edu/wpi/first/math/geometry/Pose2d.java b/wpimath/src/main/java/edu/wpi/first/math/geometry/Pose2d.java index a8f250fba2..4a84ef6543 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/geometry/Pose2d.java +++ b/wpimath/src/main/java/edu/wpi/first/math/geometry/Pose2d.java @@ -20,9 +20,9 @@ import edu.wpi.first.math.numbers.N3; import edu.wpi.first.units.measure.Distance; import edu.wpi.first.util.protobuf.ProtobufSerializable; import edu.wpi.first.util.struct.StructSerializable; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.List; import java.util.Objects; /** Represents a 2D pose containing translational and rotational elements. */ @@ -347,13 +347,13 @@ public class Pose2d implements Interpolatable, ProtobufSerializable, Str } /** - * Returns the nearest Pose2d from a list of poses. If two or more poses in the list have the same - * distance from this pose, return the one with the closest rotation component. + * Returns the nearest Pose2d from a collection of poses. If two or more poses in the collection + * have the same distance from this pose, return the one with the closest rotation component. * - * @param poses The list of poses to find the nearest. - * @return The nearest Pose2d from the list. + * @param poses The collection of poses to find the nearest. + * @return The nearest Pose2d from the collection. */ - public Pose2d nearest(List poses) { + public Pose2d nearest(Collection poses) { return Collections.min( poses, Comparator.comparing( diff --git a/wpimath/src/main/java/edu/wpi/first/math/geometry/Pose3d.java b/wpimath/src/main/java/edu/wpi/first/math/geometry/Pose3d.java index f08618b566..20204235bc 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/geometry/Pose3d.java +++ b/wpimath/src/main/java/edu/wpi/first/math/geometry/Pose3d.java @@ -21,9 +21,9 @@ import edu.wpi.first.math.numbers.N4; import edu.wpi.first.units.measure.Distance; import edu.wpi.first.util.protobuf.ProtobufSerializable; import edu.wpi.first.util.struct.StructSerializable; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.List; import java.util.Objects; /** Represents a 3D pose containing translational and rotational elements. */ @@ -400,13 +400,13 @@ public class Pose3d implements Interpolatable, ProtobufSerializable, Str } /** - * Returns the nearest Pose3d from a list of poses. If two or more poses in the list have the same - * distance from this pose, return the one with the closest rotation component. + * Returns the nearest Pose3d from a collection of poses. If two or more poses in the collection + * have the same distance from this pose, return the one with the closest rotation component. * - * @param poses The list of poses to find the nearest. - * @return The nearest Pose3d from the list. + * @param poses The collection of poses to find the nearest. + * @return The nearest Pose3d from the collection. */ - public Pose3d nearest(List poses) { + public Pose3d nearest(Collection poses) { return Collections.min( poses, Comparator.comparing( diff --git a/wpimath/src/main/java/edu/wpi/first/math/geometry/Translation2d.java b/wpimath/src/main/java/edu/wpi/first/math/geometry/Translation2d.java index 9b4af815c7..1612a5e5fa 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/geometry/Translation2d.java +++ b/wpimath/src/main/java/edu/wpi/first/math/geometry/Translation2d.java @@ -20,9 +20,9 @@ import edu.wpi.first.math.numbers.N2; import edu.wpi.first.units.measure.Distance; import edu.wpi.first.util.protobuf.ProtobufSerializable; import edu.wpi.first.util.struct.StructSerializable; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.List; import java.util.Objects; /** @@ -273,12 +273,12 @@ public class Translation2d } /** - * Returns the nearest Translation2d from a list of translations. + * Returns the nearest Translation2d from a collection of translations. * - * @param translations The list of translations. - * @return The nearest Translation2d from the list. + * @param translations The collection of translations. + * @return The nearest Translation2d from the collection. */ - public Translation2d nearest(List translations) { + public Translation2d nearest(Collection translations) { return Collections.min(translations, Comparator.comparing(this::getDistance)); } diff --git a/wpimath/src/main/java/edu/wpi/first/math/geometry/Translation3d.java b/wpimath/src/main/java/edu/wpi/first/math/geometry/Translation3d.java index 1aad1a892b..a929661ee9 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/geometry/Translation3d.java +++ b/wpimath/src/main/java/edu/wpi/first/math/geometry/Translation3d.java @@ -20,9 +20,9 @@ import edu.wpi.first.math.numbers.N3; import edu.wpi.first.units.measure.Distance; import edu.wpi.first.util.protobuf.ProtobufSerializable; import edu.wpi.first.util.struct.StructSerializable; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.List; import java.util.Objects; /** @@ -305,7 +305,7 @@ public class Translation3d * @param translations The collection of translations to find the nearest. * @return The nearest Translation3d from the collection. */ - public Translation3d nearest(List translations) { + public Translation3d nearest(Collection translations) { return Collections.min(translations, Comparator.comparing(this::getDistance)); } diff --git a/wpimath/src/main/java/edu/wpi/first/math/kinematics/MecanumDriveMotorVoltages.java b/wpimath/src/main/java/edu/wpi/first/math/kinematics/MecanumDriveMotorVoltages.java index e4c0c7e1a0..d9458049bd 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/kinematics/MecanumDriveMotorVoltages.java +++ b/wpimath/src/main/java/edu/wpi/first/math/kinematics/MecanumDriveMotorVoltages.java @@ -4,7 +4,12 @@ package edu.wpi.first.math.kinematics; -/** Represents the motor voltages for a mecanum drive drivetrain. */ +/** + * Represents the motor voltages for a mecanum drive drivetrain. + * + * @deprecated Use {@link + * edu.wpi.first.wpilibj2.command.MecanumControllerCommand.MecanumVoltagesConsumer} + */ @Deprecated(since = "2025", forRemoval = true) public class MecanumDriveMotorVoltages { /** Voltage of the front left motor. */ diff --git a/wpimath/src/main/java/edu/wpi/first/math/trajectory/TrapezoidProfile.java b/wpimath/src/main/java/edu/wpi/first/math/trajectory/TrapezoidProfile.java index ad122f8475..cbd7ead518 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/trajectory/TrapezoidProfile.java +++ b/wpimath/src/main/java/edu/wpi/first/math/trajectory/TrapezoidProfile.java @@ -59,10 +59,14 @@ public class TrapezoidProfile { /** * Constructs constraints for a TrapezoidProfile. * - * @param maxVelocity maximum velocity - * @param maxAcceleration maximum acceleration + * @param maxVelocity Maximum velocity, must be non-negative. + * @param maxAcceleration Maximum acceleration, must be non-negative. */ public Constraints(double maxVelocity, double maxAcceleration) { + if (maxVelocity < 0.0 || maxAcceleration < 0.0) { + throw new IllegalArgumentException("Constraints must be non-negative"); + } + this.maxVelocity = maxVelocity; this.maxAcceleration = maxAcceleration; MathSharedStore.reportUsage("TrapezoidProfile", ""); @@ -127,8 +131,8 @@ public class TrapezoidProfile { m_current = direct(current); goal = direct(goal); - if (m_current.velocity > m_constraints.maxVelocity) { - m_current.velocity = m_constraints.maxVelocity; + if (Math.abs(m_current.velocity) > m_constraints.maxVelocity) { + m_current.velocity = Math.copySign(m_constraints.maxVelocity, m_current.velocity); } // Deal with a possibly truncated motion profile (with nonzero initial or diff --git a/wpimath/src/main/native/include/frc/MathUtil.h b/wpimath/src/main/native/include/frc/MathUtil.h index 060be0da91..97705811f9 100644 --- a/wpimath/src/main/native/include/frc/MathUtil.h +++ b/wpimath/src/main/native/include/frc/MathUtil.h @@ -94,6 +94,42 @@ constexpr T ApplyDeadband(T value, T deadband, T maxMagnitude = T{1.0}) { } } +/** + * Raises the input to the power of the given exponent while preserving its + * sign. + * + * The function normalizes the input value to the range [0, 1] based on the + * maximum magnitude, raises it to the power of the exponent, then scales the + * result back to the original range and copying the sign. This keeps the value + * in the original range and gives consistent curve behavior regardless of the + * input value's scale. + * + * This is useful for applying smoother or more aggressive control response + * curves (e.g. joystick input shaping). + * + * @param value The input value to transform. + * @param exponent The exponent to apply (e.g. 1.0 = linear, 2.0 = squared + * curve). Must be positive. + * @param maxMagnitude The maximum expected absolute value of input. Must be + * positive. + * @return The transformed value with the same sign and scaled to the input + * range. + */ +template + requires std::is_arithmetic_v || units::traits::is_unit_t_v +constexpr T CopySignPow(T value, double exponent, T maxMagnitude = T{1.0}) { + if constexpr (std::is_arithmetic_v) { + return gcem::copysign( + gcem::pow(gcem::abs(value) / maxMagnitude, exponent) * maxMagnitude, + value); + } else { + return units::math::copysign( + gcem::pow((units::math::abs(value) / maxMagnitude).value(), exponent) * + maxMagnitude, + value); + } +} + /** * Returns modulus of input. * diff --git a/wpimath/src/main/native/include/frc/trajectory/TrapezoidProfile.h b/wpimath/src/main/native/include/frc/trajectory/TrapezoidProfile.h index 83e7d34e8f..617a3e22da 100644 --- a/wpimath/src/main/native/include/frc/trajectory/TrapezoidProfile.h +++ b/wpimath/src/main/native/include/frc/trajectory/TrapezoidProfile.h @@ -76,8 +76,8 @@ class TrapezoidProfile { /** * Constructs constraints for a Trapezoid Profile. * - * @param maxVelocity Maximum velocity. - * @param maxAcceleration Maximum acceleration. + * @param maxVelocity Maximum velocity, must be non-negative. + * @param maxAcceleration Maximum acceleration, must be non-negative. */ constexpr Constraints(Velocity_t maxVelocity, Acceleration_t maxAcceleration) @@ -85,6 +85,10 @@ class TrapezoidProfile { if (!std::is_constant_evaluated()) { wpi::math::MathSharedStore::ReportUsage("TrapezoidProfile", ""); } + + if (maxVelocity < Velocity_t{0} || maxAcceleration < Acceleration_t{0}) { + throw std::domain_error("Constraints must be non-negative"); + } } }; @@ -129,8 +133,9 @@ class TrapezoidProfile { m_direction = ShouldFlipAcceleration(current, goal) ? -1 : 1; m_current = Direct(current); goal = Direct(goal); - if (m_current.velocity > m_constraints.maxVelocity) { - m_current.velocity = m_constraints.maxVelocity; + if (units::math::abs(m_current.velocity) > m_constraints.maxVelocity) { + m_current.velocity = + units::math::copysign(m_constraints.maxVelocity, m_current.velocity); } // Deal with a possibly truncated motion profile (with nonzero initial or diff --git a/wpimath/src/test/java/edu/wpi/first/math/MathUtilTest.java b/wpimath/src/test/java/edu/wpi/first/math/MathUtilTest.java index 93ef1ef734..1fcef74d1f 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/MathUtilTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/MathUtilTest.java @@ -72,6 +72,44 @@ class MathUtilTest extends UtilityClassTest { assertEquals(80.0, MathUtil.applyDeadband(100.0, 20, Double.POSITIVE_INFINITY)); } + @Test + void testCopySignPow() { + assertEquals(0.5, MathUtil.copySignPow(0.5, 1.0)); + assertEquals(-0.5, MathUtil.copySignPow(-0.5, 1.0)); + + assertEquals(0.5 * 0.5, MathUtil.copySignPow(0.5, 2.0)); + assertEquals(-(0.5 * 0.5), MathUtil.copySignPow(-0.5, 2.0)); + + assertEquals(Math.sqrt(0.5), MathUtil.copySignPow(0.5, 0.5)); + assertEquals(-Math.sqrt(0.5), MathUtil.copySignPow(-0.5, 0.5)); + + assertEquals(0.0, MathUtil.copySignPow(0.0, 2.0)); + assertEquals(1.0, MathUtil.copySignPow(1.0, 2.0)); + assertEquals(-1.0, MathUtil.copySignPow(-1.0, 2.0)); + + assertEquals(Math.pow(0.8, 0.3), MathUtil.copySignPow(0.8, 0.3)); + assertEquals(-Math.pow(0.8, 0.3), MathUtil.copySignPow(-0.8, 0.3)); + } + + @Test + void testCopySignPowMaxMagnitude() { + assertEquals(5, MathUtil.copySignPow(5.0, 1.0, 10.0)); + assertEquals(-5, MathUtil.copySignPow(-5.0, 1.0, 10.0)); + + assertEquals(0.5 * 0.5 * 10, MathUtil.copySignPow(5.0, 2.0, 10.0)); + assertEquals(-0.5 * 0.5 * 10, MathUtil.copySignPow(-5.0, 2.0, 10.0)); + + assertEquals(Math.sqrt(0.5) * 10, MathUtil.copySignPow(5.0, 0.5, 10.0)); + assertEquals(-Math.sqrt(0.5) * 10, MathUtil.copySignPow(-5.0, 0.5, 10.0)); + + assertEquals(0.0, MathUtil.copySignPow(0.0, 2.0, 5.0)); + assertEquals(5.0, MathUtil.copySignPow(5.0, 2.0, 5.0)); + assertEquals(-5.0, MathUtil.copySignPow(-5.0, 2.0, 5.0)); + + assertEquals(Math.pow(0.8, 0.3) * 100, MathUtil.copySignPow(80, 0.3, 100.0)); + assertEquals(-Math.pow(0.8, 0.3) * 100, MathUtil.copySignPow(-80, 0.3, 100.0)); + } + @Test void testInputModulus() { // These tests check error wrapping. That is, the result of wrapping the diff --git a/wpimath/src/test/java/edu/wpi/first/math/trajectory/TrapezoidProfileTest.java b/wpimath/src/test/java/edu/wpi/first/math/trajectory/TrapezoidProfileTest.java index 72b730420f..82661295c1 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/trajectory/TrapezoidProfileTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/trajectory/TrapezoidProfileTest.java @@ -253,4 +253,46 @@ class TrapezoidProfileTest { assertNear(profile.timeLeftUntil(0), 0, 1e-10); assertNear(profile.totalTime(), 0, 1e-10); } + + @Test + void initialVelocityConstraints() { + TrapezoidProfile.Constraints constraints = new TrapezoidProfile.Constraints(0.75, 0.75); + TrapezoidProfile.State goal = new TrapezoidProfile.State(10, 0); + TrapezoidProfile.State state = new TrapezoidProfile.State(0, -10); + + TrapezoidProfile profile = new TrapezoidProfile(constraints); + + for (int i = 0; i < 200; ++i) { + state = profile.calculate(kDt, state, goal); + assertLessThanOrEquals(Math.abs(state.velocity), Math.abs(constraints.maxVelocity)); + } + } + + @Test + void goalVelocityConstraints() { + TrapezoidProfile.Constraints constraints = new TrapezoidProfile.Constraints(0.75, 0.75); + TrapezoidProfile.State goal = new TrapezoidProfile.State(10, 5); + TrapezoidProfile.State state = new TrapezoidProfile.State(0, 0.75); + + TrapezoidProfile profile = new TrapezoidProfile(constraints); + + for (int i = 0; i < 200; ++i) { + state = profile.calculate(kDt, state, goal); + assertLessThanOrEquals(Math.abs(state.velocity), Math.abs(constraints.maxVelocity)); + } + } + + @Test + void negativeGoalVelocityConstraints() { + TrapezoidProfile.Constraints constraints = new TrapezoidProfile.Constraints(0.75, 0.75); + TrapezoidProfile.State goal = new TrapezoidProfile.State(10, -5); + TrapezoidProfile.State state = new TrapezoidProfile.State(0, 0.75); + + TrapezoidProfile profile = new TrapezoidProfile(constraints); + + for (int i = 0; i < 200; ++i) { + state = profile.calculate(kDt, state, goal); + assertLessThanOrEquals(Math.abs(state.velocity), Math.abs(constraints.maxVelocity)); + } + } } diff --git a/wpimath/src/test/native/cpp/MathUtilTest.cpp b/wpimath/src/test/native/cpp/MathUtilTest.cpp index fc9405ce38..1479c0d18f 100644 --- a/wpimath/src/test/native/cpp/MathUtilTest.cpp +++ b/wpimath/src/test/native/cpp/MathUtilTest.cpp @@ -65,6 +65,61 @@ TEST(MathUtilTest, ApplyDeadbandLargeMaxMagnitude) { frc::ApplyDeadband(100.0, 20.0, std::numeric_limits::infinity())); } +TEST(MathUtilTest, CopySignPow) { + EXPECT_DOUBLE_EQ(0.5, frc::CopySignPow(0.5, 1.0)); + EXPECT_DOUBLE_EQ(-0.5, frc::CopySignPow(-0.5, 1.0)); + + EXPECT_DOUBLE_EQ(0.5 * 0.5, frc::CopySignPow(0.5, 2.0)); + EXPECT_DOUBLE_EQ(-(0.5 * 0.5), frc::CopySignPow(-0.5, 2.0)); + + EXPECT_DOUBLE_EQ(std::sqrt(0.5), frc::CopySignPow(0.5, 0.5)); + EXPECT_DOUBLE_EQ(-std::sqrt(0.5), frc::CopySignPow(-0.5, 0.5)); + + EXPECT_DOUBLE_EQ(0.0, frc::CopySignPow(0.0, 2.0)); + EXPECT_DOUBLE_EQ(1.0, frc::CopySignPow(1.0, 2.0)); + EXPECT_DOUBLE_EQ(-1.0, frc::CopySignPow(-1.0, 2.0)); + + EXPECT_DOUBLE_EQ(std::pow(0.8, 0.3), frc::CopySignPow(0.8, 0.3)); + EXPECT_DOUBLE_EQ(-std::pow(0.8, 0.3), frc::CopySignPow(-0.8, 0.3)); +} + +TEST(MathUtilTest, CopySignPowWithMaxMagnitude) { + EXPECT_DOUBLE_EQ(5.0, frc::CopySignPow(5.0, 1.0, 10.0)); + EXPECT_DOUBLE_EQ(-5.0, frc::CopySignPow(-5.0, 1.0, 10.0)); + + EXPECT_DOUBLE_EQ(0.5 * 0.5 * 10, frc::CopySignPow(5.0, 2.0, 10.0)); + EXPECT_DOUBLE_EQ(-0.5 * 0.5 * 10, frc::CopySignPow(-5.0, 2.0, 10.0)); + + EXPECT_DOUBLE_EQ(std::sqrt(0.5) * 10, frc::CopySignPow(5.0, 0.5, 10.0)); + EXPECT_DOUBLE_EQ(-std::sqrt(0.5) * 10, frc::CopySignPow(-5.0, 0.5, 10.0)); + + EXPECT_DOUBLE_EQ(0.0, frc::CopySignPow(0.0, 2.0, 5.0)); + EXPECT_DOUBLE_EQ(5.0, frc::CopySignPow(5.0, 2.0, 5.0)); + EXPECT_DOUBLE_EQ(-5.0, frc::CopySignPow(-5.0, 2.0, 5.0)); + + EXPECT_DOUBLE_EQ(std::pow(0.8, 0.3) * 100, + frc::CopySignPow(80.0, 0.3, 100.0)); + EXPECT_DOUBLE_EQ(-std::pow(0.8, 0.3) * 100, + frc::CopySignPow(-80.0, 0.3, 100.0)); +} + +TEST(MathUtilTest, CopySignPowWithUnits) { + EXPECT_DOUBLE_EQ( + 0, frc::CopySignPow(0_mps, 2.0).value()); + EXPECT_DOUBLE_EQ( + 1, frc::CopySignPow(1_mps, 2.0).value()); + EXPECT_DOUBLE_EQ( + -1, frc::CopySignPow(-1_mps, 2.0).value()); + + EXPECT_DOUBLE_EQ( + 0.5 * 0.5 * 10, + frc::CopySignPow(5_mps, 2.0, 10_mps).value()); + EXPECT_DOUBLE_EQ( + -0.5 * 0.5 * 10, + frc::CopySignPow(-5_mps, 2.0, 10_mps) + .value()); +} + TEST(MathUtilTest, InputModulus) { // These tests check error wrapping. That is, the result of wrapping the // result of an angle reference minus the measurement. diff --git a/wpimath/src/test/native/cpp/trajectory/TrapezoidProfileTest.cpp b/wpimath/src/test/native/cpp/trajectory/TrapezoidProfileTest.cpp index e83da634b6..0846e8b74c 100644 --- a/wpimath/src/test/native/cpp/trajectory/TrapezoidProfileTest.cpp +++ b/wpimath/src/test/native/cpp/trajectory/TrapezoidProfileTest.cpp @@ -241,3 +241,48 @@ TEST(TrapezoidProfileTest, InitalizationOfCurrentState) { EXPECT_NEAR_UNITS(profile.TimeLeftUntil(0_m), 0_s, 1e-10_s); EXPECT_NEAR_UNITS(profile.TotalTime(), 0_s, 1e-10_s); } + +TEST(TrapezoidProfileTest, InitialVelocityConstraints) { + frc::TrapezoidProfile::Constraints constraints{0.75_mps, + 0.75_mps_sq}; + frc::TrapezoidProfile::State goal{10_m, 0_mps}; + frc::TrapezoidProfile::State state{0_m, -10_mps}; + + frc::TrapezoidProfile profile{constraints}; + + for (int i = 0; i < 200; ++i) { + state = profile.Calculate(kDt, state, goal); + EXPECT_LE(units::math::abs(state.velocity), + units::math::abs(constraints.maxVelocity)); + } +} + +TEST(TrapezoidProfileTest, GoalVelocityConstraints) { + frc::TrapezoidProfile::Constraints constraints{0.75_mps, + 0.75_mps_sq}; + frc::TrapezoidProfile::State goal{10_m, 5_mps}; + frc::TrapezoidProfile::State state{0_m, 0.75_mps}; + + frc::TrapezoidProfile profile{constraints}; + + for (int i = 0; i < 200; ++i) { + state = profile.Calculate(kDt, state, goal); + EXPECT_LE(units::math::abs(state.velocity), + units::math::abs(constraints.maxVelocity)); + } +} + +TEST(TrapezoidProfileTest, NegativeGoalVelocityConstraints) { + frc::TrapezoidProfile::Constraints constraints{0.75_mps, + 0.75_mps_sq}; + frc::TrapezoidProfile::State goal{10_m, -5_mps}; + frc::TrapezoidProfile::State state{0_m, 0.75_mps}; + + frc::TrapezoidProfile profile{constraints}; + + for (int i = 0; i < 200; ++i) { + state = profile.Calculate(kDt, state, goal); + EXPECT_LE(units::math::abs(state.velocity), + units::math::abs(constraints.maxVelocity)); + } +} diff --git a/wpiutil/BUILD.bazel b/wpiutil/BUILD.bazel index f04f772913..3760063605 100644 --- a/wpiutil/BUILD.bazel +++ b/wpiutil/BUILD.bazel @@ -92,12 +92,6 @@ third_party_cc_lib_helper( src_root = "src/main/native/thirdparty/llvm/cpp", ) -third_party_cc_lib_helper( - name = "memory", - include_root = "src/main/native/thirdparty/memory/include", - src_root = "src/main/native/thirdparty/memory/src", -) - third_party_cc_lib_helper( name = "mpack", include_root = "src/main/native/thirdparty/mpack/include", @@ -159,7 +153,6 @@ wpilib_cc_library( ":debugging", ":fmtlib", ":llvm", - ":memory", ":mpack", ":nanopb", ":protobuf", diff --git a/wpiutil/CMakeLists.txt b/wpiutil/CMakeLists.txt index e0af46d8df..d48214e516 100644 --- a/wpiutil/CMakeLists.txt +++ b/wpiutil/CMakeLists.txt @@ -130,9 +130,8 @@ file(GLOB_RECURSE wpiutil_macos_src src/main/native/macOS/*.cpp) file(GLOB_RECURSE wpiutil_windows_src src/main/native/windows/*.cpp) file(GLOB fmtlib_native_src src/main/native/thirdparty/fmtlib/src/*.cpp) -file(GLOB_RECURSE memory_native_src src/main/native/thirdparty/memory/src/*.cpp) -add_library(wpiutil ${wpiutil_native_src} ${memory_native_src} ${wpiutil_resources_src}) +add_library(wpiutil ${wpiutil_native_src} ${wpiutil_resources_src}) set_target_properties(wpiutil PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET wpiutil PROPERTY FOLDER "libraries") @@ -199,7 +198,6 @@ install( src/main/native/thirdparty/expected/include/ src/main/native/thirdparty/json/include/ src/main/native/thirdparty/llvm/include/ - src/main/native/thirdparty/memory/include/ src/main/native/thirdparty/mpack/include/ src/main/native/thirdparty/nanopb/include/ src/main/native/thirdparty/sigslot/include/ @@ -214,7 +212,6 @@ target_include_directories( $ $ $ - $ $ $ $ diff --git a/wpiutil/build.gradle b/wpiutil/build.gradle index 3bdf4cef00..4b3d51803e 100644 --- a/wpiutil/build.gradle +++ b/wpiutil/build.gradle @@ -80,16 +80,6 @@ ext { srcDirs 'src/main/native/thirdparty/sigslot/include' } } - memoryCpp(CppSourceSet) { - source { - srcDirs 'src/main/native/thirdparty/memory/src', 'src/main/native/thirdparty/memory/include/wpi/memory' - include '**/*.cpp' - } - exportedHeaders { - srcDirs 'src/main/native/thirdparty/memory/include' - include '**/*.hpp' - } - } protobufCpp(CppSourceSet) { source { srcDirs 'src/main/native/thirdparty/protobuf/src' @@ -191,7 +181,6 @@ cppHeadersZip { 'src/main/native/thirdparty/mpack/include', 'src/main/native/thirdparty/nanopb/include', 'src/main/native/thirdparty/sigslot/include', - 'src/main/native/thirdparty/memory/include', 'src/main/native/thirdparty/protobuf/include' ] @@ -213,9 +202,6 @@ cppSourcesZip { from('src/main/native/thirdparty/llvm/cpp') { into '/' } - from('src/main/native/thirdparty/memory/src') { - into '/' - } from('src/main/native/thirdparty/mpack/src') { into '/' } @@ -235,7 +221,7 @@ model { all { it.sources.each { it.exportedHeaders { - srcDirs 'src/main/native/include', 'src/main/native/thirdparty/argparse/include/', 'src/main/native/thirdparty/debugging/include', 'src/main/native/thirdparty/expected/include', 'src/main/native/thirdparty/fmtlib/include', 'src/main/native/thirdparty/llvm/include', 'src/main/native/thirdparty/sigslot/include', 'src/main/native/thirdparty/json/include', 'src/main/native/thirdparty/memory/include', 'src/main/native/thirdparty/mpack/include', 'src/main/native/thirdparty/protobuf/include', 'src/main/native/thirdparty/nanopb/include' + srcDirs 'src/main/native/include', 'src/main/native/thirdparty/argparse/include/', 'src/main/native/thirdparty/debugging/include', 'src/main/native/thirdparty/expected/include', 'src/main/native/thirdparty/fmtlib/include', 'src/main/native/thirdparty/llvm/include', 'src/main/native/thirdparty/sigslot/include', 'src/main/native/thirdparty/json/include', 'src/main/native/thirdparty/mpack/include', 'src/main/native/thirdparty/protobuf/include', 'src/main/native/thirdparty/nanopb/include' } } } diff --git a/wpiutil/src/main/native/thirdparty/memory/include/wpi/memory/aligned_allocator.hpp b/wpiutil/src/main/native/thirdparty/memory/include/wpi/memory/aligned_allocator.hpp deleted file mode 100644 index dce436fc4f..0000000000 --- a/wpiutil/src/main/native/thirdparty/memory/include/wpi/memory/aligned_allocator.hpp +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors -// SPDX-License-Identifier: Zlib - -#ifndef WPI_MEMORY_ALIGNED_ALLOCATOR_HPP_INCLUDED -#define WPI_MEMORY_ALIGNED_ALLOCATOR_HPP_INCLUDED - -/// \file -/// Class \ref wpi::memory::aligned_allocator and related functions. - -#include - -#include "detail/assert.hpp" -#include "detail/utility.hpp" -#include "allocator_traits.hpp" -#include "config.hpp" - -namespace wpi -{ - namespace memory - { - /// A RawAllocator adapter that ensures a minimum alignment. - /// It adjusts the alignment value so that it is always larger than the minimum and forwards to the specified allocator. - /// \ingroup memory_adapter - template - class aligned_allocator : WPI_EBO(allocator_traits::allocator_type) - { - using traits = allocator_traits; - using composable_traits = composable_allocator_traits; - using composable = is_composable_allocator; - - public: - using allocator_type = typename allocator_traits::allocator_type; - using is_stateful = std::true_type; - - /// \effects Creates it passing it the minimum alignment value and the allocator object. - /// \requires \c min_alignment must be less than \c this->max_alignment(). - explicit aligned_allocator(std::size_t min_alignment, allocator_type&& alloc = {}) - : allocator_type(detail::move(alloc)), min_alignment_(min_alignment) - { - WPI_MEMORY_ASSERT(min_alignment_ <= max_alignment()); - } - - /// @{ - /// \effects Moves the \c aligned_allocator object. - /// It simply moves the underlying allocator. - aligned_allocator(aligned_allocator&& other) noexcept - : allocator_type(detail::move(other)), min_alignment_(other.min_alignment_) - { - } - - aligned_allocator& operator=(aligned_allocator&& other) noexcept - { - allocator_type::operator=(detail::move(other)); - min_alignment_ = other.min_alignment_; - return *this; - } - /// @} - - /// @{ - /// \effects Forwards to the underlying allocator through the \ref allocator_traits. - /// If the \c alignment is less than the \c min_alignment(), it is set to the minimum alignment. - void* allocate_node(std::size_t size, std::size_t alignment) - { - if (min_alignment_ > alignment) - alignment = min_alignment_; - return traits::allocate_node(get_allocator(), size, alignment); - } - - void* allocate_array(std::size_t count, std::size_t size, std::size_t alignment) - { - if (min_alignment_ > alignment) - alignment = min_alignment_; - return traits::allocate_array(get_allocator(), count, size, alignment); - } - - void deallocate_node(void* ptr, std::size_t size, std::size_t alignment) noexcept - { - if (min_alignment_ > alignment) - alignment = min_alignment_; - traits::deallocate_node(get_allocator(), ptr, size, alignment); - } - - void deallocate_array(void* ptr, std::size_t count, std::size_t size, - std::size_t alignment) noexcept - { - if (min_alignment_ > alignment) - alignment = min_alignment_; - traits::deallocate_array(get_allocator(), ptr, count, size, alignment); - } - /// @} - - /// @{ - /// \effects Forwards to the underlying allocator through the \ref composable_allocator_traits. - /// If the \c alignment is less than the \c min_alignment(), it is set to the minimum alignment. - /// \requires The underyling allocator must be composable. - WPI_ENABLE_IF(composable::value) - void* try_allocate_node(std::size_t size, std::size_t alignment) noexcept - { - if (min_alignment_ > alignment) - alignment = min_alignment_; - return composable_traits::try_allocate_node(get_allocator(), size, alignment); - } - - WPI_ENABLE_IF(composable::value) - void* try_allocate_array(std::size_t count, std::size_t size, - std::size_t alignment) noexcept - { - if (min_alignment_ > alignment) - alignment = min_alignment_; - return composable_traits::try_allocate_array(get_allocator(), count, size, - alignment); - } - - WPI_ENABLE_IF(composable::value) - bool try_deallocate_node(void* ptr, std::size_t size, std::size_t alignment) noexcept - { - if (min_alignment_ > alignment) - alignment = min_alignment_; - return composable_traits::try_deallocate_node(get_allocator(), ptr, size, - alignment); - } - - WPI_ENABLE_IF(composable::value) - bool try_deallocate_array(void* ptr, std::size_t count, std::size_t size, - std::size_t alignment) noexcept - { - if (min_alignment_ > alignment) - alignment = min_alignment_; - return composable_traits::try_deallocate_array(get_allocator(), ptr, count, size, - alignment); - } - /// @} - - /// @{ - /// \returns The value returned by the \ref allocator_traits for the underlying allocator. - std::size_t max_node_size() const - { - return traits::max_node_size(get_allocator()); - } - - std::size_t max_array_size() const - { - return traits::max_array_size(get_allocator()); - } - - std::size_t max_alignment() const - { - return traits::max_alignment(get_allocator()); - } - /// @} - - /// @{ - /// \returns A reference to the underlying allocator. - allocator_type& get_allocator() noexcept - { - return *this; - } - - const allocator_type& get_allocator() const noexcept - { - return *this; - } - /// @} - - /// \returns The minimum alignment. - std::size_t min_alignment() const noexcept - { - return min_alignment_; - } - - /// \effects Sets the minimum alignment to a new value. - /// \requires \c min_alignment must be less than \c this->max_alignment(). - void set_min_alignment(std::size_t min_alignment) - { - WPI_MEMORY_ASSERT(min_alignment <= max_alignment()); - min_alignment_ = min_alignment; - } - - private: - std::size_t min_alignment_; - }; - - /// \returns A new \ref aligned_allocator created by forwarding the parameters to the constructor. - /// \relates aligned_allocator - template - auto make_aligned_allocator(std::size_t min_alignment, RawAllocator&& allocator) noexcept - -> aligned_allocator::type> - { - return aligned_allocator< - typename std::decay::type>{min_alignment, - detail::forward(allocator)}; - } - } // namespace memory -} // namespace wpi - -#endif // WPI_MEMORY_ALIGNED_ALLOCATOR_HPP_INCLUDED diff --git a/wpiutil/src/main/native/thirdparty/memory/include/wpi/memory/allocator_storage.hpp b/wpiutil/src/main/native/thirdparty/memory/include/wpi/memory/allocator_storage.hpp deleted file mode 100644 index 96fc46e589..0000000000 --- a/wpiutil/src/main/native/thirdparty/memory/include/wpi/memory/allocator_storage.hpp +++ /dev/null @@ -1,933 +0,0 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors -// SPDX-License-Identifier: Zlib - -#ifndef WPI_MEMORY_ALLOCATOR_STORAGE_HPP_INCLUDED -#define WPI_MEMORY_ALLOCATOR_STORAGE_HPP_INCLUDED - -/// \file -/// Class template \ref wpi::memory::allocator_storage, some policies and resulting typedefs. - -#include -#include - -#include "detail/utility.hpp" -#include "config.hpp" -#include "allocator_traits.hpp" -#include "threading.hpp" - -namespace wpi -{ - namespace memory - { - namespace detail - { - template - void* try_allocate_node(std::true_type, Alloc& alloc, std::size_t size, - std::size_t alignment) noexcept - { - return composable_allocator_traits::try_allocate_node(alloc, size, - alignment); - } - - template - void* try_allocate_array(std::true_type, Alloc& alloc, std::size_t count, - std::size_t size, std::size_t alignment) noexcept - { - return composable_allocator_traits::try_allocate_array(alloc, count, size, - alignment); - } - - template - bool try_deallocate_node(std::true_type, Alloc& alloc, void* ptr, std::size_t size, - std::size_t alignment) noexcept - { - return composable_allocator_traits::try_deallocate_node(alloc, ptr, size, - alignment); - } - - template - bool try_deallocate_array(std::true_type, Alloc& alloc, void* ptr, std::size_t count, - std::size_t size, std::size_t alignment) noexcept - { - return composable_allocator_traits::try_deallocate_array(alloc, ptr, count, - size, alignment); - } - - template - void* try_allocate_node(std::false_type, Alloc&, std::size_t, std::size_t) noexcept - { - WPI_MEMORY_UNREACHABLE("Allocator is not compositioning"); - return nullptr; - } - - template - void* try_allocate_array(std::false_type, Alloc&, std::size_t, std::size_t, - std::size_t) noexcept - { - WPI_MEMORY_UNREACHABLE("Allocator is not compositioning"); - return nullptr; - } - - template - bool try_deallocate_node(std::false_type, Alloc&, void*, std::size_t, - std::size_t) noexcept - { - WPI_MEMORY_UNREACHABLE("Allocator is not compositioning"); - return false; - } - - template - bool try_deallocate_array(std::false_type, Alloc&, void*, std::size_t, std::size_t, - std::size_t) noexcept - { - WPI_MEMORY_UNREACHABLE("Allocator is not compositioning"); - return false; - } - } // namespace detail - - /// A RawAllocator that stores another allocator. - /// The StoragePolicy defines the allocator type being stored and how it is stored. - /// The \c Mutex controls synchronization of the access. - /// \ingroup memory_storage - template - class allocator_storage - : WPI_EBO(StoragePolicy, - detail::mutex_storage< - detail::mutex_for>) - { - using traits = allocator_traits; - using composable_traits = - composable_allocator_traits; - using composable = is_composable_allocator; - using actual_mutex = const detail::mutex_storage< - detail::mutex_for>; - - public: - using allocator_type = typename StoragePolicy::allocator_type; - using storage_policy = StoragePolicy; - using mutex = Mutex; - using is_stateful = typename traits::is_stateful; - - /// \effects Creates it by default-constructing the \c StoragePolicy. - /// \requires The \c StoragePolicy must be default-constructible. - /// \notes The default constructor may create an invalid allocator storage not associated with any allocator. - /// If that is the case, it must not be used. - allocator_storage() = default; - - /// \effects Creates it by passing it an allocator. - /// The allocator will be forwarded to the \c StoragePolicy, it decides whether it will be moved, its address stored or something else. - /// \requires The expression new storage_policy(std::forward(alloc)) must be well-formed, - /// otherwise this constructor does not participate in overload resolution. - template < - class Alloc, - // MSVC seems to ignore access rights in SFINAE below - // use this to prevent this constructor being chosen instead of move for types inheriting from it - WPI_REQUIRES( - (!std::is_base_of::type>::value))> - allocator_storage(Alloc&& alloc, - WPI_SFINAE(new storage_policy(std::declval()))) - : storage_policy(detail::forward(alloc)) - { - } - - /// \effects Creates it by passing it another \c allocator_storage with a different \c StoragePolicy but the same \c Mutex type. - /// Initializes it with the result of \c other.get_allocator(). - /// \requires The expression new storage_policy(other.get_allocator()) must be well-formed, - /// otherwise this constructor does not participate in overload resolution. - template - allocator_storage( - const allocator_storage& other, - WPI_SFINAE(new storage_policy( - std::declval&>().get_allocator()))) - : storage_policy(other.get_allocator()) - { - } - - /// @{ - /// \effects Moves the \c allocator_storage object. - /// A moved-out \c allocator_storage object must still store a valid allocator object. - allocator_storage(allocator_storage&& other) noexcept - : storage_policy(detail::move(other)), - detail::mutex_storage< - detail::mutex_for>( - detail::move(other)) - { - } - - allocator_storage& operator=(allocator_storage&& other) noexcept - { - storage_policy:: operator=(detail::move(other)); - detail::mutex_storage>::operator=(detail::move(other)); - return *this; - } - /// @} - - /// @{ - /// \effects Copies the \c allocator_storage object. - /// \requires The \c StoragePolicy must be copyable. - allocator_storage(const allocator_storage&) = default; - allocator_storage& operator=(const allocator_storage&) = default; - /// @} - - /// @{ - /// \effects Calls the function on the stored allocator. - /// The \c Mutex will be locked during the operation. - void* allocate_node(std::size_t size, std::size_t alignment) - { - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - return traits::allocate_node(alloc, size, alignment); - } - - void* allocate_array(std::size_t count, std::size_t size, std::size_t alignment) - { - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - return traits::allocate_array(alloc, count, size, alignment); - } - - void deallocate_node(void* ptr, std::size_t size, std::size_t alignment) noexcept - { - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - traits::deallocate_node(alloc, ptr, size, alignment); - } - - void deallocate_array(void* ptr, std::size_t count, std::size_t size, - std::size_t alignment) noexcept - { - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - traits::deallocate_array(alloc, ptr, count, size, alignment); - } - - std::size_t max_node_size() const - { - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - return traits::max_node_size(alloc); - } - - std::size_t max_array_size() const - { - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - return traits::max_array_size(alloc); - } - - std::size_t max_alignment() const - { - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - return traits::max_alignment(alloc); - } - /// @} - - /// @{ - /// \effects Calls the function on the stored composable allocator. - /// The \c Mutex will be locked during the operation. - /// \requires The allocator must be composable, - /// i.e. \ref is_composable() must return `true`. - /// \note This check is done at compile-time where possible, - /// and at runtime in the case of type-erased storage. - WPI_ENABLE_IF(composable::value) - void* try_allocate_node(std::size_t size, std::size_t alignment) noexcept - { - WPI_MEMORY_ASSERT(is_composable()); - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - return composable_traits::try_allocate_node(alloc, size, alignment); - } - - WPI_ENABLE_IF(composable::value) - void* try_allocate_array(std::size_t count, std::size_t size, - std::size_t alignment) noexcept - { - WPI_MEMORY_ASSERT(is_composable()); - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - return composable_traits::try_allocate_array(alloc, count, size, alignment); - } - - WPI_ENABLE_IF(composable::value) - bool try_deallocate_node(void* ptr, std::size_t size, std::size_t alignment) noexcept - { - WPI_MEMORY_ASSERT(is_composable()); - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - return composable_traits::try_deallocate_node(alloc, ptr, size, alignment); - } - - WPI_ENABLE_IF(composable::value) - bool try_deallocate_array(void* ptr, std::size_t count, std::size_t size, - std::size_t alignment) noexcept - { - WPI_MEMORY_ASSERT(is_composable()); - std::lock_guard lock(*this); - auto&& alloc = get_allocator(); - return composable_traits::try_deallocate_array(alloc, ptr, count, size, alignment); - } - /// @} - - /// @{ - /// \effects Forwards to the \c StoragePolicy. - /// \returns Returns a reference to the stored allocator. - /// \note This does not lock the \c Mutex. - auto get_allocator() noexcept - -> decltype(std::declval().get_allocator()) - { - return storage_policy::get_allocator(); - } - - auto get_allocator() const noexcept - -> decltype(std::declval().get_allocator()) - { - return storage_policy::get_allocator(); - } - /// @} - - /// @{ - /// \returns A proxy object that acts like a pointer to the stored allocator. - /// It cannot be reassigned to point to another allocator object and only moving is supported, which is destructive. - /// As long as the proxy object lives and is not moved from, the \c Mutex will be kept locked. - auto lock() noexcept -> WPI_IMPL_DEFINED(decltype(detail::lock_allocator( - std::declval().get_allocator(), std::declval()))) - { - return detail::lock_allocator(get_allocator(), static_cast(*this)); - } - - auto lock() const noexcept -> WPI_IMPL_DEFINED(decltype(detail::lock_allocator( - std::declval().get_allocator(), - std::declval()))) - { - return detail::lock_allocator(get_allocator(), static_cast(*this)); - } - /// @}. - - /// \returns Whether or not the stored allocator is composable, - /// that is you can use the compositioning functions. - /// \note Due to type-erased allocators, - /// this function can not be `constexpr`. - bool is_composable() const noexcept - { - return StoragePolicy::is_composable(); - } - }; - - /// Tag type that enables type-erasure in \ref reference_storage. - /// It can be used everywhere a \ref allocator_reference is used internally. - /// \ingroup memory_storage - struct any_allocator - { - }; - - /// A StoragePolicy that stores the allocator directly. - /// It embeds the allocator inside it, i.e. moving the storage policy will move the allocator. - /// \ingroup memory_storage - template - class direct_storage : WPI_EBO(allocator_traits::allocator_type) - { - static_assert(!std::is_same::value, - "cannot type-erase in direct_storage"); - - public: - using allocator_type = typename allocator_traits::allocator_type; - - /// \effects Creates it by default-constructing the allocator. - /// \requires The \c RawAllcoator must be default constructible. - direct_storage() = default; - - /// \effects Creates it by moving in an allocator object. - direct_storage(allocator_type&& allocator) noexcept - : allocator_type(detail::move(allocator)) - { - } - - /// @{ - /// \effects Moves the \c direct_storage object. - /// This will move the stored allocator. - direct_storage(direct_storage&& other) noexcept : allocator_type(detail::move(other)) {} - - direct_storage& operator=(direct_storage&& other) noexcept - { - allocator_type::operator=(detail::move(other)); - return *this; - } - /// @} - - /// @{ - /// \returns A (\c const) reference to the stored allocator. - allocator_type& get_allocator() noexcept - { - return *this; - } - - const allocator_type& get_allocator() const noexcept - { - return *this; - } - /// @} - - protected: - ~direct_storage() noexcept = default; - - bool is_composable() const noexcept - { - return is_composable_allocator::value; - } - }; - - /// An alias template for \ref allocator_storage using the \ref direct_storage policy without a mutex. - /// It has the effect of giving any RawAllocator the interface with all member functions, - /// avoiding the need to wrap it inside the \ref allocator_traits. - /// \ingroup memory_storage - template - WPI_ALIAS_TEMPLATE(allocator_adapter, - allocator_storage, no_mutex>); - - /// \returns A new \ref allocator_adapter object created by forwarding to the constructor. - /// \relates allocator_adapter - template - auto make_allocator_adapter(RawAllocator&& allocator) noexcept - -> allocator_adapter::type> - { - return {detail::forward(allocator)}; - } - -/// An alias template for \ref allocator_storage using the \ref direct_storage policy with a mutex. -/// It has a similar effect as \ref allocator_adapter but performs synchronization. -/// The \c Mutex will default to \c std::mutex if threading is supported, -/// otherwise there is no default. -/// \ingroup memory_storage -#if WPI_HOSTED_IMPLEMENTATION - template - WPI_ALIAS_TEMPLATE(thread_safe_allocator, - allocator_storage, Mutex>); -#else - template - WPI_ALIAS_TEMPLATE(thread_safe_allocator, - allocator_storage, Mutex>); -#endif - -#if WPI_HOSTED_IMPLEMENTATION - /// \returns A new \ref thread_safe_allocator object created by forwarding to the constructor/ - /// \relates thread_safe_allocator - template - auto make_thread_safe_allocator(RawAllocator&& allocator) - -> thread_safe_allocator::type> - { - return detail::forward(allocator); - } -#endif - - /// \returns A new \ref thread_safe_allocator object created by forwarding to the constructor, - /// specifying a certain mutex type. - /// \requires It requires threading support from the implementation. - /// \relates thread_safe_allocator - template - auto make_thread_safe_allocator(RawAllocator&& allocator) - -> thread_safe_allocator::type, Mutex> - { - return detail::forward(allocator); - } - - namespace detail - { - struct reference_stateful - { - }; - struct reference_stateless - { - }; - struct reference_shared - { - }; - - reference_stateful reference_type(std::true_type stateful, std::false_type shared); - reference_stateless reference_type(std::false_type stateful, std::true_type shared); - reference_stateless reference_type(std::false_type stateful, std::false_type shared); - reference_shared reference_type(std::true_type stateful, std::true_type shared); - - template - class reference_storage_impl; - - // reference to stateful: stores a pointer to an allocator - template - class reference_storage_impl - { - protected: - reference_storage_impl() noexcept : alloc_(nullptr) {} - - reference_storage_impl(RawAllocator& allocator) noexcept : alloc_(&allocator) {} - - bool is_valid() const noexcept - { - return alloc_ != nullptr; - } - - RawAllocator& get_allocator() const noexcept - { - WPI_MEMORY_ASSERT(alloc_ != nullptr); - return *alloc_; - } - - private: - RawAllocator* alloc_; - }; - - // reference to stateless: store in static storage - template - class reference_storage_impl - { - protected: - reference_storage_impl() noexcept = default; - - reference_storage_impl(const RawAllocator&) noexcept {} - - bool is_valid() const noexcept - { - return true; - } - - RawAllocator& get_allocator() const noexcept - { - static RawAllocator alloc; - return alloc; - } - }; - - // reference to shared: stores RawAllocator directly - template - class reference_storage_impl - { - protected: - reference_storage_impl() noexcept = default; - - reference_storage_impl(const RawAllocator& alloc) noexcept : alloc_(alloc) {} - - bool is_valid() const noexcept - { - return true; - } - - RawAllocator& get_allocator() const noexcept - { - return alloc_; - } - - private: - mutable RawAllocator alloc_; - }; - } // namespace detail - - /// Specifies whether or not a RawAllocator has shared semantics. - /// It is shared, if - like \ref allocator_reference - if multiple objects refer to the same internal allocator and if it can be copied. - /// This sharing is stateful, however, stateless allocators are not considered shared in the meaning of this traits.
- /// If a \c RawAllocator is shared, it will be directly embedded inside \ref reference_storage since it already provides \ref allocator_reference like semantics, so there is no need to add them manually,
- /// Specialize it for your own types, if they provide sharing semantics and can be copied. - /// They also must provide an `operator==` to check whether two allocators refer to the same shared one. - /// \note This makes no guarantees about the lifetime of the shared object, the sharing allocators can either own or refer to a shared object. - /// \ingroup memory_storage - template - struct is_shared_allocator : std::false_type - { - }; - - /// A StoragePolicy that stores a reference to an allocator. - /// For stateful allocators it only stores a pointer to an allocator object and copying/moving only copies the pointer. - /// For stateless allocators it does not store anything, an allocator will be constructed as needed. - /// For allocators that are already shared (determined through \ref is_shared_allocator) it will store the allocator type directly. - /// \note It does not take ownership over the allocator in the stateful case, the user has to ensure that the allocator object stays valid. - /// In the other cases the lifetime does not matter. - /// \ingroup memory_storage - template - class reference_storage -#ifndef DOXYGEN - : WPI_EBO(detail::reference_storage_impl< - typename allocator_traits::allocator_type, - decltype(detail::reference_type( - typename allocator_traits::is_stateful{}, - is_shared_allocator{}))>) -#endif - { - using storage = detail::reference_storage_impl< - typename allocator_traits::allocator_type, - decltype(detail::reference_type(typename allocator_traits< - RawAllocator>::is_stateful{}, - is_shared_allocator{}))>; - - public: - using allocator_type = typename allocator_traits::allocator_type; - - /// Default constructor. - /// \effects If the allocator is stateless, this has no effect and the object is usable as an allocator. - /// If the allocator is stateful, creates an invalid reference without any associated allocator. - /// Then it must not be used. - /// If the allocator is shared, default constructs the shared allocator. - /// If the shared allocator does not have a default constructor, this constructor is ill-formed. - reference_storage() noexcept = default; - - /// \effects Creates it from a stateless or shared allocator. - /// It will not store anything, only creates the allocator as needed. - /// \requires The \c RawAllocator is stateless or shared. - reference_storage(const allocator_type& alloc) noexcept : storage(alloc) {} - - /// \effects Creates it from a reference to a stateful allocator. - /// It will store a pointer to this allocator object. - /// \note The user has to take care that the lifetime of the reference does not exceed the allocator lifetime. - reference_storage(allocator_type& alloc) noexcept : storage(alloc) {} - - /// @{ - /// \effects Copies the \c allocator_reference object. - /// Only copies the pointer to it in the stateful case. - reference_storage(const reference_storage&) noexcept = default; - reference_storage& operator=(const reference_storage&) noexcept = default; - /// @} - - /// \returns Whether or not the reference is valid. - /// It is only invalid, if it was created by the default constructor and the allocator is stateful. - explicit operator bool() const noexcept - { - return storage::is_valid(); - } - - /// \returns Returns a reference to the allocator. - /// \requires The reference must be valid. - allocator_type& get_allocator() const noexcept - { - return storage::get_allocator(); - } - - protected: - ~reference_storage() noexcept = default; - - bool is_composable() const noexcept - { - return is_composable_allocator::value; - } - }; - - /// Specialization of the class template \ref reference_storage that is type-erased. - /// It is triggered by the tag type \ref any_allocator. - /// The specialization can store a reference to any allocator type. - /// \ingroup memory_storage - template <> - class reference_storage - { - class base_allocator - { - public: - using is_stateful = std::true_type; - - virtual ~base_allocator() = default; - - virtual void clone(void* storage) const noexcept = 0; - - void* allocate_node(std::size_t size, std::size_t alignment) - { - return allocate_impl(1, size, alignment); - } - - void* allocate_array(std::size_t count, std::size_t size, std::size_t alignment) - { - return allocate_impl(count, size, alignment); - } - - void deallocate_node(void* node, std::size_t size, std::size_t alignment) noexcept - { - deallocate_impl(node, 1, size, alignment); - } - - void deallocate_array(void* array, std::size_t count, std::size_t size, - std::size_t alignment) noexcept - { - deallocate_impl(array, count, size, alignment); - } - - void* try_allocate_node(std::size_t size, std::size_t alignment) noexcept - { - return try_allocate_impl(1, size, alignment); - } - - void* try_allocate_array(std::size_t count, std::size_t size, - std::size_t alignment) noexcept - { - return try_allocate_impl(count, size, alignment); - } - - bool try_deallocate_node(void* node, std::size_t size, - std::size_t alignment) noexcept - { - return try_deallocate_impl(node, 1, size, alignment); - } - - bool try_deallocate_array(void* array, std::size_t count, std::size_t size, - std::size_t alignment) noexcept - { - return try_deallocate_impl(array, count, size, alignment); - } - - // count 1 means node - virtual void* allocate_impl(std::size_t count, std::size_t size, - std::size_t alignment) = 0; - virtual void deallocate_impl(void* ptr, std::size_t count, std::size_t size, - std::size_t alignment) noexcept = 0; - - virtual void* try_allocate_impl(std::size_t count, std::size_t size, - std::size_t alignment) noexcept = 0; - - virtual bool try_deallocate_impl(void* ptr, std::size_t count, std::size_t size, - std::size_t alignment) noexcept = 0; - - std::size_t max_node_size() const - { - return max(query::node_size); - } - - std::size_t max_array_size() const - { - return max(query::array_size); - } - - std::size_t max_alignment() const - { - return max(query::alignment); - } - - virtual bool is_composable() const noexcept = 0; - - protected: - enum class query - { - node_size, - array_size, - alignment - }; - - virtual std::size_t max(query q) const = 0; - }; - - public: - using allocator_type = WPI_IMPL_DEFINED(base_allocator); - - /// \effects Creates it from a reference to any stateful RawAllocator. - /// It will store a pointer to this allocator object. - /// \note The user has to take care that the lifetime of the reference does not exceed the allocator lifetime. - template - reference_storage(RawAllocator& alloc) noexcept - { - static_assert(sizeof(basic_allocator) - <= sizeof(basic_allocator), - "requires all instantiations to have certain maximum size"); - ::new (static_cast(&storage_)) basic_allocator(alloc); - } - - // \effects Creates it from any stateless RawAllocator. - /// It will not store anything, only creates the allocator as needed. - /// \requires The \c RawAllocator is stateless. - template - reference_storage( - const RawAllocator& alloc, - WPI_REQUIRES(!allocator_traits::is_stateful::value)) noexcept - { - static_assert(sizeof(basic_allocator) - <= sizeof(basic_allocator), - "requires all instantiations to have certain maximum size"); - ::new (static_cast(&storage_)) basic_allocator(alloc); - } - - /// \effects Creates it from the internal base class for the type-erasure. - /// Has the same effect as if the actual stored allocator were passed to the other constructor overloads. - /// \note This constructor is used internally to avoid double-nesting. - reference_storage(const WPI_IMPL_DEFINED(base_allocator) & alloc) noexcept - { - alloc.clone(&storage_); - } - - /// \effects Creates it from the internal base class for the type-erasure. - /// Has the same effect as if the actual stored allocator were passed to the other constructor overloads. - /// \note This constructor is used internally to avoid double-nesting. - reference_storage(WPI_IMPL_DEFINED(base_allocator) & alloc) noexcept - : reference_storage(static_cast(alloc)) - { - } - - /// @{ - /// \effects Copies the \c reference_storage object. - /// It only copies the pointer to the allocator. - reference_storage(const reference_storage& other) noexcept - { - other.get_allocator().clone(&storage_); - } - - reference_storage& operator=(const reference_storage& other) noexcept - { - get_allocator().~allocator_type(); - other.get_allocator().clone(&storage_); - return *this; - } - /// @} - - /// \returns A reference to the allocator. - /// The actual type is implementation-defined since it is the base class used in the type-erasure, - /// but it provides the full RawAllocator member functions. - /// \note There is no way to access any custom member functions of the allocator type. - allocator_type& get_allocator() const noexcept - { - auto mem = static_cast(&storage_); - return *static_cast(mem); - } - - protected: - ~reference_storage() noexcept - { - get_allocator().~allocator_type(); - } - - bool is_composable() const noexcept - { - return get_allocator().is_composable(); - } - - private: - template - class basic_allocator - : public base_allocator, - private detail::reference_storage_impl< - typename allocator_traits::allocator_type, - decltype(detail::reference_type(typename allocator_traits< - RawAllocator>::is_stateful{}, - is_shared_allocator{}))> - { - using traits = allocator_traits; - using composable = is_composable_allocator; - using storage = detail::reference_storage_impl< - typename allocator_traits::allocator_type, - decltype(detail::reference_type(typename allocator_traits< - RawAllocator>::is_stateful{}, - is_shared_allocator{}))>; - - public: - // non stateful - basic_allocator(const RawAllocator& alloc) noexcept : storage(alloc) {} - - // stateful - basic_allocator(RawAllocator& alloc) noexcept : storage(alloc) {} - - private: - typename traits::allocator_type& get() const noexcept - { - return storage::get_allocator(); - } - - void clone(void* storage) const noexcept override - { - ::new (storage) basic_allocator(get()); - } - - void* allocate_impl(std::size_t count, std::size_t size, - std::size_t alignment) override - { - auto&& alloc = get(); - if (count == 1u) - return traits::allocate_node(alloc, size, alignment); - else - return traits::allocate_array(alloc, count, size, alignment); - } - - void deallocate_impl(void* ptr, std::size_t count, std::size_t size, - std::size_t alignment) noexcept override - { - auto&& alloc = get(); - if (count == 1u) - traits::deallocate_node(alloc, ptr, size, alignment); - else - traits::deallocate_array(alloc, ptr, count, size, alignment); - } - - void* try_allocate_impl(std::size_t count, std::size_t size, - std::size_t alignment) noexcept override - { - auto&& alloc = get(); - if (count == 1u) - return detail::try_allocate_node(composable{}, alloc, size, alignment); - else - return detail::try_allocate_array(composable{}, alloc, count, size, - alignment); - } - - bool try_deallocate_impl(void* ptr, std::size_t count, std::size_t size, - std::size_t alignment) noexcept override - { - auto&& alloc = get(); - if (count == 1u) - return detail::try_deallocate_node(composable{}, alloc, ptr, size, - alignment); - else - return detail::try_deallocate_array(composable{}, alloc, ptr, count, size, - alignment); - } - - bool is_composable() const noexcept override - { - return composable::value; - } - - std::size_t max(query q) const override - { - auto&& alloc = get(); - if (q == query::node_size) - return traits::max_node_size(alloc); - else if (q == query::array_size) - return traits::max_array_size(alloc); - return traits::max_alignment(alloc); - } - }; - - // use a stateful instantiation to determine size and alignment - // base_allocator is stateful - using default_instantiation = basic_allocator; - alignas(default_instantiation) mutable char storage_[sizeof(default_instantiation)]; - }; - - /// An alias template for \ref allocator_storage using the \ref reference_storage policy. - /// It will store a reference to the given allocator type. The tag type \ref any_allocator enables type-erasure. - /// Wrap the allocator in a \ref thread_safe_allocator if you want thread safety. - /// \ingroup memory_storage - template - WPI_ALIAS_TEMPLATE(allocator_reference, - allocator_storage, no_mutex>); - - /// \returns A new \ref allocator_reference object by forwarding the allocator to the constructor. - /// \relates allocator_reference - template - auto make_allocator_reference(RawAllocator&& allocator) noexcept - -> allocator_reference::type> - { - return {detail::forward(allocator)}; - } - - /// An alias for the \ref reference_storage specialization using type-erasure. - /// \ingroup memory_storage - using any_reference_storage = reference_storage; - - /// An alias for \ref allocator_storage using the \ref any_reference_storage. - /// It will store a reference to any RawAllocator. - /// This is the same as passing the tag type \ref any_allocator to the alias \ref allocator_reference. - /// Wrap the allocator in a \ref thread_safe_allocator if you want thread safety. - /// \ingroup memory_storage - using any_allocator_reference = allocator_storage; - - /// \returns A new \ref any_allocator_reference object by forwarding the allocator to the constructor. - /// \relates any_allocator_reference - template - auto make_any_allocator_reference(RawAllocator&& allocator) noexcept - -> any_allocator_reference - { - return {detail::forward(allocator)}; - } - } // namespace memory -} // namespace wpi - -#endif // WPI_MEMORY_ALLOCATOR_STORAGE_HPP_INCLUDED diff --git a/wpiutil/src/main/native/thirdparty/memory/include/wpi/memory/allocator_traits.hpp b/wpiutil/src/main/native/thirdparty/memory/include/wpi/memory/allocator_traits.hpp deleted file mode 100644 index 9bd92a0442..0000000000 --- a/wpiutil/src/main/native/thirdparty/memory/include/wpi/memory/allocator_traits.hpp +++ /dev/null @@ -1,601 +0,0 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors -// SPDX-License-Identifier: Zlib - -#ifndef WPI_MEMORY_ALLOCATOR_TRAITS_HPP_INCLUDED -#define WPI_MEMORY_ALLOCATOR_TRAITS_HPP_INCLUDED - -/// \file -/// The default specialization of the \ref wpi::memory::allocator_traits. - -#include -#include - -#include "detail/align.hpp" -#include "detail/utility.hpp" -#include "config.hpp" - -#if WPI_HOSTED_IMPLEMENTATION -#include -#endif - -namespace wpi -{ - namespace memory - { - namespace detail - { - template - std::true_type has_construct(int, WPI_SFINAE(std::declval().construct( - std::declval(), - std::declval()))); - - template - std::false_type has_construct(short); - - template - std::true_type has_destroy(int, WPI_SFINAE(std::declval().destroy( - std::declval()))); - - template - std::false_type has_destroy(short); - - template - struct check_standard_allocator - { - using custom_construct = decltype(has_construct(0)); - using custom_destroy = decltype(has_destroy(0)); - - using valid = std::integral_constant; - }; - } // namespace detail - - /// Traits class that checks whether or not a standard \c Allocator can be used as RawAllocator. - /// It checks the existence of a custom \c construct(), \c destroy() function, if provided, - /// it cannot be used since it would not be called.
- /// Specialize it for custom \c Allocator types to override this check. - /// \ingroup memory_core - template - struct allocator_is_raw_allocator - : WPI_EBO(detail::check_standard_allocator::valid) - { - }; - - /// Specialization of \ref allocator_is_raw_allocator that allows \c std::allocator again. - /// \ingroup memory_core - template - struct allocator_is_raw_allocator> : std::true_type - { - }; - - namespace traits_detail // use seperate namespace to avoid name clashes - { - // full_concept has the best conversion rank, error the lowest - // used to give priority to the functions - struct error - { - operator void*() const noexcept - { - WPI_MEMORY_UNREACHABLE( - "this is just to hide an error and move static_assert to the front"); - return nullptr; - } - }; - struct std_concept : error - { - }; - struct min_concept : std_concept - { - }; - struct full_concept : min_concept - { - }; - - // used to delay assert in handle_error() until instantiation - template - struct invalid_allocator_concept - { - static const bool error = false; - }; - - //=== allocator_type ===// - // if Allocator has a member template `rebind`, use that to rebind to `char` - // else if Allocator has a member `value_type`, rebind by changing argument - // else does nothing - template - auto rebind_impl(int) -> typename Allocator::template rebind::other&; - - template - struct allocator_rebinder - { - using type = Allocator&; - }; - - template