"Did you know that:
(1) const methods can legally modify members?
(2) A const object cannot be default-initialized? (this makes sense after a minute)
(2)(b) Unless... a default constructor is declared non-inline?
(3) The standard does not properly account for volatile members of const objects?
All this and (probably not much) more, at this lightning talk."
---
Ofek Shilon
__
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk
From C++ Templates to C++ Concepts - The Amazing Journey of Metaprogramming - Alex Dathskovsky - CppCon 2022
https://github.com/CppCon/CppCon2022
Metaprogramming is been with us since C++98 but as the language evolves we have more tools and the code get simpler and clearer. In this talk we will cover the history of Templates and how the usage and readability became clearer and simpler with each standard. We will develop a concept with c++11-c++17 for checking if a type is container and then we will discover how c++20 concepts make the whole thing much easier.
In this talk we will cover the grounds of Template meta programming with quick walkthrough of how templates work and how template metaprogramming has evolved with every C++ standard. The talk will have present the evolution and benefits with many code examples. The larges example will be the development of a concept for Containers and how it is simplified with Concepts.
---
Alex Dathskovsky
Alex has over 16 years of software development experience, working on systems, low-level generic tools and high-level applications. Alex has worked as an integration/software developer at Elbit, senior software developer at Rafael, technical leader at Axxana, Software manager at Abbott Israel and now a group manager a technical manager at Speedata.io an Exciting startup the will change Big Data and analytics as we know it .On His current Job Alex is developing a new CPU/APU system working with C++20, Massive metaprogramming and development of LLVM to create the next Big thing for Big Data.
Alex is a C++ expert with a strong experience in template meta-programming. Alex also teaches a course about the new features of modern C++, trying to motivate companies to move to the latest standards.
__
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk
Help! My Codebase has 5 JSON Libraries - How Generic Programming Rescued Me - Christopher McArthur - CppCon 2022
https://github.com/CppCon/CppCon2022
In 2019 working on a RESTful cloud oriented C++ application, everything was JSON. Inbound communication was handled with an ASIO based web server, RESTinio, and used RapidJSON to handle the API payload. Outbound was handled by CPPRESTSDK which had its own JSON implementation. To handle authorization, we picked the best C++ JSON Web Token (JWT) library but that was written on top of PicoJSON, a small minimalistic unmainted library. We then had 3 different JSON libraries to work with and mix together.
How do we make this work together? “Why don’t you template out the logic and metaprogram a traits implementation?” Geeze, Thanks Gareth! So that’s what I did.
Generic cppcon.digital-medium.co.uk/tag/programming/">programming is writing algorithms in such a way that the type can be specified later. Using templates the algorithm can operate on different types if they satisfy certain traits (or implement a certain concept). JSON Web Tokens should follow the same algorithm regardless of the JSON implementation - this seemed like a useful case for applying generic cppcon.digital-medium.co.uk/tag/programming/">programming.
Six months and a lot of learning later, I had opened a pull request against the JWT-CPP library.
Using templates, SFINAE, and static assertions I was able to abstract the “JSON” out of the JSON Web Token (JWT) logic. I am able to answer questions like: How can the compiler know…
What is the signature of a function? Does it match a known signature? Is it close enough?
If a type has a member function? What is the return type of the method? Can it differentiate between static and member functions?
Yes. The compiler is really that well informed and the tools and techniques exist to programmatically answer them at compile time.
Templating the JSON “value and types” played in favor with the existing design of a C++ single file header only library. Being an Open-source project it was important to maintain the existing compiler requirements, this bound the implementation to C++11 however there are C++17 features (i.e. `std::void_t`) and experimental features (i.e. `std::experimental::is_detected`) which are back-ported.
A JSON Traits needs to declare a generic value type, and concert basic types which match the JWT’s family of RFC defined claims (which are JSON keys) such as object, string, or double. All the types were substituted into templates to check for concepts, for instance, `object_type` needs to be iterable, so a `constexpr` value is set if begin and end methods are present. Some traits are optional and substitution failure is not an error.
With several of the most popular JSON libraries like Niel Lohamn’s and Boost’s supported, this approach can work for any project looking to decouple the application logic from a library specific container. There are some drawbacks, such as complexity and mind melting error messages. Recent compilers with support for Concepts makes future possibilities very exciting.
---
Christopher McArthur
Chris has been giving back to the open source community with exploit database containers, C++/ CMake build system maintenance, and other OSS projects for nearly ten years. He began his career as a C++ developer and has since then added other languages including Golang and Typescript to his skill set. Prior to joining the Conan team at JFrog, Chris previously worked in the video broadcast and mobile advertising industries on a variety of projects. His diverse experiences include Blockchain, low-level hardware networking, distributed systems security, and cloud-native DevOps. As a developer advocate for JFrog, Chris deals with Conan, Chris shares his deep to the knowledge of DevOps and Package Management to the C++ Community globally.
__
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk