The New C++ Library: Strong Library Foundation for Future Projects - Jonathan Müller & Arno Schödl

  Рет қаралды 7,080

CppNow

CppNow

9 ай бұрын

www.cppnow.org​
/ cppnow
---
The New C++ Library on the Block: A Strong Library Foundation for Your Next Project - Jonathan Müller / Arno Schödl - CppNow 2023
Slides: github.com/boostcon
---
We have given many conceptual talks about iterators, ranges, string formatting, and generic programming in the past. Now, we would like to present the library that is the foundation of our code base and that lets us write code the way we like it: Short, elegant, and to the point.
Did you know that std::move can be called on a const reference? And that you cannot move out of that const reference but will silently copy? Wouldn't it be nice to get a compiler error in that case?
Our range implementation is more powerful and easier to use than std::ranges. We treat generator functions as ranges, too. With the same syntax as iterator-based ranges, you often do not need to know the difference.
We extend the standard range algorithms (and our own additional algorithms) with return type arguments that express common programming patterns elegantly: How often did you call std::ranges::find_if and compare the result to an end iterator? Wouldn't it be shorter and more elegant to write something like tc::find_if tc::return_bool?
The talk will focus on actual usage, rather than conceptual ideas. The library is open-source, header-only and thus easy to integrate into any project. For any new project, it will be a significant head start over the standard library. We strive for our library to be close to the standard library in names and conventions, so it is compatible with std ranges and algorithms and you can mix and match it with other libraries.
---
Jonathan Müller
Jonathan is a library developer at think-cell. In his spare time, he works on various C++ open source libraries for memory allocation, cache-friendly containers, or parsing. He also blogs at foonathan.net and is a member of the C++ standardization committee.
Arno Schödl
Founder & CTO
Arno is responsible for the design, architecture and development of all our software products. He oversees think-cell's R&D team, Quality Assurance and Customer Care.
Before founding think-cell, Arno worked at Microsoft Research and McKinsey. Arno studied computer science and management and holds a Ph.D. from the Georgia Institute of Technology with a specialization in Computer Graphics.
---
Video Sponsors: think-cell and Bloomberg Engineering
Audience Audio Sponsors: Innoplex and Maryland Research Institute
---
Videos Filmed & Edited By Bash Films: bashfilms.com/
KZbin Channel Managed & Optimized By Digital Medium Ltd: events.digital-medium.co.uk
---
CppNow 2024
www.cppnow.org​
/ cppnow
---
#boost #cpp #cppprogramming

Пікірлер: 16
@will1am
@will1am 9 ай бұрын
Finally a interesting presentation where they talk about C++ and not about some alternative C++ WIP languages ( or Rust) , at an event called CPPnow... Great!
@XzatonJW
@XzatonJW 8 ай бұрын
Im still not really used to the range-based stuff, and haven't seen enough uses of it to make me really think its a good idea. But the monadic stuff of programming the happy path and letting the "if it didnt work then bail early" type code does seem very neat.
@simonfarre4907
@simonfarre4907 9 ай бұрын
As far as I am aware you "can't" (shouldn't) use span as substitute for string_view. A string_view is a view (immutable) while span is a range (possibly mutable), no?
@OMGclueless
@OMGclueless 9 ай бұрын
I don't think there's any difference in representation between std::string_view and std::span. Just some minor API differences related to how they're expected to be used.
@foonathan
@foonathan 9 ай бұрын
But you can use `std::span`.
@MatthewWalker0
@MatthewWalker0 9 ай бұрын
lots of fun utils! Maybe just an oversight, but couple didn't have examples :( (at least for the best solution). Eg. final version of the scope_exit/defer, which is used like `tc_scope_exit [&] { do stuff; };` i think? Looks like a keyword!
@foonathan
@foonathan 9 ай бұрын
It's `tc_scope_exit { do stuff; }`. Yes, that it looks like a keyword is very much the idea.
@acestapp1884
@acestapp1884 7 ай бұрын
Is find_first_if extensible? Or is the purpose to allow forwarding or the return types? What's the advantage over using different names, like find_first_if_bool() etc.?
@foonathan
@foonathan 7 ай бұрын
It is extensible. As in: You can write your own ReturnType policy. We do not have different names, because we have a couple dozen return type policies for a couple dozen algorithms. That would be hundreds of algorithms.
@Roibarkan
@Roibarkan 9 ай бұрын
6:08 Jonathan mentions the use of concepts in tandem with traits that can be specialized (in order to specifically opt-in/out of the concept). I wonder why think-cell chose to use concepts here, and not just have a trait with the same value. On the other hand, I wonder why concepts can’t be specialized (almost every other ‘templated’ thing in c++ can be specialized)
@foonathan
@foonathan 9 ай бұрын
That's a common idiom, e.g. `std::borrowed_range` has `std::enable_borrowed_range` you can specialize.
@Roibarkan
@Roibarkan 9 ай бұрын
Thanks for the reply. Indeed, allowing concepts to be overridden via specialization of some bool-like template is a common idiom in the language. In this comment I tried to ask 'why'. More specifically, I note that concepts are one of very few templated notions that cannot be specialized - and I see it as a potentially missing part in the language, that people work-around with this common idiom. When I choose whether to use a concept or another bool-like template - I am very aware of this limitation, and don't know if I should instinctively delegate add 'and not disable_my_concept' to most of the concepts I write (to allow opt out, like disable_sized_range), whether to add 'or enable_my_concept' like in this case, or perhaps to avoid using concepts in places where there's a good reason for users to specialize due to semantic knowledge of they types that can't be expressed generically. I wonder what is your take on this.
@Roibarkan
@Roibarkan 9 ай бұрын
@@foonathan BTW, in my talk from cppnow 2021 about concepts I call this idiom "Semantic sugar", because it allows people to give the compiler information about the semantics of their types. kzbin.info/www/bejne/q2HVp3iDi52Ep5Y
@CuriousCauliflowerX
@CuriousCauliflowerX 9 ай бұрын
This is a great advertisement for Rust.
@pauldraper1736
@pauldraper1736 9 ай бұрын
Glad you love these videos so much.
@TNothingFree
@TNothingFree 9 ай бұрын
Important talk but pretty boring sorry. Very hard to listen to
Ну Лилит))) прода в онк: завидные котики
00:51
Super sport🤯
00:15
Lexa_Merin
Рет қаралды 20 МЛН
How I prepare to meet the brothers Mbappé.. 🙈 @KylianMbappe
00:17
Celine Dept
Рет қаралды 56 МЛН
Better C++ ranges - Arno Schödl - Meeting C++ 2023
1:04:59
Meeting Cpp
Рет қаралды 1,6 М.
-memory-safe C++ - Jim Radigan - CppCon 2022
1:05:45
CppCon
Рет қаралды 21 М.
Индуктивность и дроссель.
1:00
Hi Dev! – Электроника
Рет қаралды 1,6 МЛН
Эволюция телефонов!
0:30
ТРЕНДИ ШОРТС
Рет қаралды 6 МЛН
iPhone 12 socket cleaning #fixit
0:30
Tamar DB (mt)
Рет қаралды 12 МЛН