Enough string_view to hang ourselves - Victor Ciura

  Рет қаралды 582

NDC Conferences

NDC Conferences

Күн бұрын

Wouldn’t it be nice if we had a standard C++ type to represent strings ? Oh, wait... we do: std::string. Wouldn’t it be nice if we could use that standard type throughout our whole application/project ? Well… we can’t ! Unless we’re writing a console app or a service.
But, if we’re writing an app with GUI or interacting with modern OS APIs, chances are that we’ll need to deal with at least one other non-standard C++ string type. Depending on the platform and project, it may be CString from MFC or ATL, Platform::String from WinRT, QString from Qt, wxString from wxWidgets, etc. Oh, let’s not forget our old friend `const char*`, better yet `const wchar_t*` for the C family of APIs…
So we ended up with two string types in our codebase. OK, that’s manageable: we stick with std::string for all platform independent code and convert back-and-forth to the other XString when interacting with system APIs or GUI code. We’ll make some unnecessary copies when crossing this bridge and we’ll end up with some funny looking functions juggling two types of strings; but that’s glue code, anyway… right?
It’s a good plan... until our project grows and we accumulate lots of string utilities and algorithms. Do we restrict those algorithmic goodies to std::string ? Do we fallback on the common denominator `const char*` and lose the type/memory safety of our C++ type ? Is C++17 std::string_view the answer to all our string problems ?
We’ll try to explore our options, together, with a case study on a 15 year old Windows application: Advanced Installer (www.advancedinstaller.com) - an actively developed C++ project, modernized to C++17, thanks to clang-tidy and “Clang Power Tools” (www.clangpowertools.com).
NDC Conferences
ndcoslo.com
ndcconferences...

Пікірлер
Billions of Sensors - The UX Beyond the Screen - Niklas Norin
55:39
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
SIDELNIKOVVV
Рет қаралды 4,1 МЛН
小丑家的感情危机!#小丑#天使#家庭
00:15
家庭搞笑日记
Рет қаралды 32 МЛН
Yay, My Dad Is a Vending Machine! 🛍️😆 #funny #prank #comedy
00:17
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
C++ Weekly - Ep 73 - std::string_view
7:42
C++ Weekly With Jason Turner
Рет қаралды 29 М.
Blueprints vs. C++: How They Fit Together and Why You Should Use Both
47:14
CppCon 2014: Mike Acton "Data-Oriented Design and C++"
1:27:46
The Worst Programming Language Ever - Mark Rendle - NDC Oslo 2021
1:00:41
NDC Conferences
Рет қаралды 1,3 МЛН
The Art of Code - Dylan Beattie
1:00:49
NDC Conferences
Рет қаралды 4,7 МЛН
The Only Unbreakable Law
53:25
Molly Rocket
Рет қаралды 332 М.
Как остановить электрический счетчик импульсным прибором
0:23
Остановка счетчика на воду, газ, электричество
Рет қаралды 1,6 МЛН
Секретный пароль...
0:17
Сокровищница Фактов
Рет қаралды 422 М.
Keyboard Cleaning Hack
0:36
IAM
Рет қаралды 11 МЛН