C++ Templates Revised - Nicolai Josuttis [ACCU 2018]

  Рет қаралды 9,555

ACCU Conference

ACCU Conference

Күн бұрын

Пікірлер: 10
@tikabass
@tikabass 6 жыл бұрын
13:05 - this issue can be easily resolved using auto for the return type. template auto concat(const T& a, const T& b) { return a + b; } ... Which means that auto _should_ be your first choice as a return type fort such templates.
@MrM12LRV
@MrM12LRV 6 жыл бұрын
This guy is so cool
@gast128
@gast128 6 жыл бұрын
Good talk though I would hope they focus more on libraries and build times then yet another template trick.
@christophrcr
@christophrcr 6 жыл бұрын
20:10 -> How does this change affect the lifetime of the result of compute(t)?
@YourCRTube
@YourCRTube 6 жыл бұрын
It has its life extended like a const &
@Lecopivo
@Lecopivo 6 жыл бұрын
Is there a nice way to implement the print function such that it can be called without a single argument? i.e. print() is valid.
@atib1980
@atib1980 6 жыл бұрын
Here is my first attempt at coding a simple short variadic function template for such a print function: template int print(ConstCharPointerType format = " ", Args&&... args) { static_assert(is_same::value || is_same::value, "Specified format parameter's type (template parameter " "'ConstCharPointerType') must be either const char* or const " "wchar_t*!"); if constexpr (is_same::value) { return printf(format, std::forward(args)...); } if constexpr (is_same::value) { if (!strcmp(format, " ")) format = L" "; return wprintf(format, std::forward(args)...); } } // or here is one possible simple implementation for a python like print function using 2 variadic function templates: void printArgument() { cout
@abdullahalattar5642
@abdullahalattar5642 6 жыл бұрын
template void print(Args&&... args) { ((std::cout
105 STL Algorithms in Less Than an Hour - Jonathan Boccara [ACCU 2018]
53:31
Thank you Santa
00:13
Nadir Show
Рет қаралды 27 МЛН
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 135 МЛН
CppCon 2018: Jason Turner “Applied Best Practices”
1:03:19
CppCon 2014: Scott Meyers "Type Deduction and Why You Care"
1:09:34
How to Adopt Modern C++17 into Your C++ Code : Build 2018
50:51
Microsoft Developer
Рет қаралды 76 М.
C++ Coroutines - Don’t Try This at Home - Lieven de Cock - ACCU 2024
1:26:04
Writing cache friendly C++ - Jonathan Müller - Meeting C++ 2018
54:38