Tag: cpp11

Nth Pack Element in C++ – A Case Study – Kris Jusiak – CppCon 2022

https://cppcon.digital-medium.co.uk/tag/cppcon/">cppcon.org/
---

Nth Pack Element in C++ - A Case Study - Kris Jusiak - CppCon 2022
https://github.com/CppCon/CppCon2022

Varadic packs have been with us since C++11, however getting the nth element efficiently out of a variadic pack still remains not optimal/difficult.
During the years, with new standards emerging, more and more approaches have been discovered but no silver bullet has been found yet or has it?
If understanding of how std::get<N>(tuple) works sounds compeling then this session is for you!

In this case study we will explore different techniques of accessing the nth element of a variadic pack... starting from naive approaches, through template meta-cppcon.digital-medium.co.uk/tag/programming/">programming tricks, to compiler intrinsics. We will also focus and deep dive into C++20 features which enables new techniques in order to understand modern ways of dealing with variadic packs...

Comparison against different solutions also will be conducted including compilation times as well as readability including comparison between different languages such as Rust, Nim, D, Circle and C++.

At the end of this session, the audience will have a better understanding of C++20 features and how to deal with variadic packs... and how it compares to different system languages.

Let's get ready to get nth element at CppCon 2022!
---

Kris Jusiak

Kris is a Senior Software Architect passionate about cppcon.digital-medium.co.uk/tag/programming/">programming and who has worked in different industries over the years including telecommunications, games and most recently finance for Quantlab Financial, LLC. He has an interest in modern C++ development with a focus on performance and quality. He is an open-source enthusiast with multiple open-source libraries where he uses template meta-cppcon.digital-medium.co.uk/tag/programming/">programming techniques to support the C++ rule - "Don't pay for what you don't use" whilst trying to be as declarative as possible with a help of domain-specific languages. Kris is also a keen advocate of extreme cppcon.digital-medium.co.uk/tag/programming/">programming techniques, Test/Behavior Driven Development and truly believes that 'the only way to go fast is to go well!'.
__

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

#cppcon.digital-medium.co.uk/tag/cppcon/">cppcon #cppcon.digital-medium.co.uk/tag/programming/">programming #cpp

Filed under: UncategorizedTagged with: , , , , , ,

From C++ Templates to C++ Concepts – Metaprogramming: an Amazing Journey – Alex Dathskovsky

https://cppcon.digital-medium.co.uk/tag/cppcon/">cppcon.org/
---

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

#cppcon.digital-medium.co.uk/tag/cppcon/">cppcon #cpp #cppprogramming

Filed under: UncategorizedTagged with: , , , , , , ,

10 Years of Meeting C++ – Historical Highlights and the Future of C++ – Jens Weller – CppCon 2022

https://cppcon.digital-medium.co.uk/tag/cppcon/">cppcon.org/
---

10 Years of Meeting C++ - Historical Highlights and the Future of C++ - Jens Weller - CppCon 2022
https://github.com/CppCon/CppCon2022

As of 2022 its now 10 years that Meeting C++ exists. With this talk I'd like to share the experiences made through running and organizing a conference and platform for the C++ community during the last decade. Going from an all new C++11 to seeing C++23 becoming complete in 2022, the last years offered many interesting and exciting new things for C++. And the amazing thing is that this process hasn't stopped, looking forward we can see an entirely new version of C++ slowly taking shape. So lets take a look at the highlights we've had and whats ahead for C++ in the coming years.
---

Jens Weller

Jens Weller is the organizer and founder of Meeting C++. Doing C++ since 1998, he is an active member of the C++ Community. From being a moderator at c-plusplus.de and organizer of his own C++ User Group since 2011 in Düsseldorf, his roots are in the C++ Community. Today his main work is running the Meeting C++ Platform (conference, website, social media and recruiting). His main role has become being a C++ evangelist, as this he speaks and travels to other conferences and user groups around the world.
---

Videos Streamed & Edited by Digital Medium: http://online.digital-medium.co.uk

#cppcon.digital-medium.co.uk/tag/cppcon/">cppcon #cppcon.digital-medium.co.uk/tag/programming/">programming #cpp

Filed under: UncategorizedTagged with: , , , ,

Embracing Trailing Return Types and `auto` Return SAFELY in Modern C++ – Pablo Halpern – CppCon 2022

https://cppcon.digital-medium.co.uk/tag/cppcon/">cppcon.org/
---

Embracing Trailing Return Types and `auto` Return SAFELY in Modern C++ - Pablo Halpern - CppCon 2022
https://github.com/CppCon/CppCon2022

In the old days (and in C), the return type of a function was specified at the beginning of its prototype, after the storage-class specifiers, if any. Modern C++ adds two additional ways to specify a function's return type, adding convenience, uniformity of expression, and, in some cases, clarity. Trailing return types were introduced in C++11 and have several potential advantages over leading return types, especially for function templates and lambda expressions. Automatically deduced return types go a step further, allowing the programmer to eschew specification of the return type entirely and letting the compiler do all of the work. These features can be used to great advantage when the return type of a function is complex or is best expressed directly as the type of an expression. Used unwisely, though, deduced return types can impede readability, create excessive coupling between the interface and the implementation of a function, and create latent bugs in template code. In this talk, we will cover the syntax and restrictions for these two new features, examine their relationship to each other, explore several use cases for each, and -- most importantly -- probe potential pitfalls when attempting to employ these language features.
---

Pablo Halpern

Pablo Halpern has been cppcon.digital-medium.co.uk/tag/programming/">programming in C++ since 1989 and has been a member of the C++ Standards Committee since 2007. His major contributions to the standard have been in the areas of parallel and vector cppcon.digital-medium.co.uk/tag/programming/">programming constructs as well as on improvements to the usability of memory allocators. Pablo is a major contributor to the book, Embracing Modern C++ Safely by John Lakos and Vittorio Romeo (2021) and is the author of The C++ Standard Library from Scratch (2000). His current development focus is in moving the API of the open-source BDE library in the direction of the C++17 PMR allocator model. He lives with his partner in Boston, MA. When not working on books and allocators, he enjoys model rocketry, hiking, skiing, snowboarding, and watching opera. He has recently started learning Pickleball.
---

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

#cppcon.digital-medium.co.uk/tag/cppcon/">cppcon #cppcon.digital-medium.co.uk/tag/programming/">programming #cpp

Filed under: UncategorizedTagged with: , , , , , , ,

Back to Basics: C++ Smart Pointers – David Olsen – CppCon 2022

https://cppcon.org/
---

Back to Basics: C++ Smart Pointers - David Olsen - CppCon 2022
https://github.com/CppCon/CppCon2022

Smart pointers were one of the many powerful additions to C++11, providing programmers with easy-to-use tools to help manage memory resources and avoid certain kinds of memory errors. This back-to-basics session will give you a solid foundation in smart pointers, explaining what smart pointers are in general and how to use the standard smart pointer types std::unique_ptr and std::shared_ptr. It will present a set of clear guidelines for when and how to use smart pointers. Attendees will leave this session having learned, among other things, how to write code that never leaks memory.
---

David Olsen

David Olsen has more than two decades of software development experience in a variety of programming languages and development environments. For the last six years he has been the lead engineer for the NVIDIA HPC C++ compiler, focusing on running parallel algorithms on GPUs. He is a member of the ISO C++ committee, where he was the champion for the extended floating-point feature in C++23.
---

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

#cppcon #programming #coding

Filed under: UncategorizedTagged with: , , , , , ,

Help! My Codebase has 5 JSON Libraries – How Generic Programming Rescued Me – Christopher McArthur

https://cppcon.digital-medium.co.uk/tag/cppcon/">cppcon.org/
---

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

#cppcon.digital-medium.co.uk/tag/cppcon/">cppcon #cppcon.digital-medium.co.uk/tag/programming/">programming #cpp

Filed under: UncategorizedTagged with: , , , , , , , , ,