Introducing xstd::any<N, Features...>, an extension of C++17’s std::any, designed to be a type-safe, owning container that can handle any data type with enhanced functionality. xstd::any can be configured with additional features such as comparability, hashability, and streamability, making it ready for use in std::map, std::unordered_map, and for output operations. This template-based implementation utilizes small object optimization to store types smaller than N bytes directly, avoiding heap allocation and minimizing dynamic memory overhead. The presentation will explore the internal design and implementation of xstd::any<>, focusing on how it manages memory efficiently and maintains value semantics even when dynamically allocating larger objects. The session will showcase practical use cases, demonstrate usage with standard C++ containers, and explore the recent C++ features that enhance its functionality. Like std::variant or std::tuple, xstd::any requires mechanisms to handle various contained object types seamlessly. We will discuss the addition of stream operators, hash functionality, and comparison operators, enhancing its usability across different programming scenarios.
Outline: * Requirements: Understanding the needs for a versatile container like xstd::any, compared to other generic container types. * Example Use Cases: Demonstrating practical applications and benefits. Implementation and Memory Layout: Deep dive into technical details and optimizations. * Testing: Approaches to ensure reliability and performance. * Exception Safety: Handling errors and exceptions. * Interaction with std:: Containers: Integration strategies and examples. * Question & Answers: Open floor for audience queries and discussions.
Presentation Materials & Source Code: All resources, including detailed presentation slides and the source code, are freely available on GitHub for further exploration and testing.