CPP_LECTS_RUS Telegram 210
Всем привет. Очередная лекция по компиляторам завтра в 9 утра, а сегодня вечер пятницы и небольшой брейн-тизер по C++.

template<typename T = void>
int foo(int x) { return 1; }

int foo(...) { return 2; }

template<typename T = void>
int bar() { return 1; }

int bar(...) { return 2; }

int main() {
std::cout << foo(2) << std::endl; // ?
std::cout << bar() << std::endl; // ???
}


https://godbolt.org/z/qfsEvxh4E

Громадное спасибо за него Владиславу Белову https://www.tgoop.com/you_are_RTshnik наткнувшемуся на эту красоту во время выполнения одного из моих заданий.

Задача довольно обычная — объяснить в чём разница с детальными ссылками на C++23. Призов не будет, кроме зрительских симпатий.

P. S. книгу обещают перепечатать к 15 ноября.

UPD: Уважаемый подписчик Артём Колпаков @ddvamp развил и усилил пример до https://godbolt.org/z/ab31ah199

#questions #cpp_postgraduate
🔥50🤪10👍8🤔2🥴1🌚1🫡1💘1



tgoop.com/cpp_lects_rus/210
Create:
Last Update:

Всем привет. Очередная лекция по компиляторам завтра в 9 утра, а сегодня вечер пятницы и небольшой брейн-тизер по C++.

template<typename T = void>
int foo(int x) { return 1; }

int foo(...) { return 2; }

template<typename T = void>
int bar() { return 1; }

int bar(...) { return 2; }

int main() {
std::cout << foo(2) << std::endl; // ?
std::cout << bar() << std::endl; // ???
}


https://godbolt.org/z/qfsEvxh4E

Громадное спасибо за него Владиславу Белову https://www.tgoop.com/you_are_RTshnik наткнувшемуся на эту красоту во время выполнения одного из моих заданий.

Задача довольно обычная — объяснить в чём разница с детальными ссылками на C++23. Призов не будет, кроме зрительских симпатий.

P. S. книгу обещают перепечатать к 15 ноября.

UPD: Уважаемый подписчик Артём Колпаков @ddvamp развил и усилил пример до https://godbolt.org/z/ab31ah199

#questions #cpp_postgraduate

BY C++ and other lectures




Share with your friend now:
tgoop.com/cpp_lects_rus/210

View MORE
Open in Telegram


Telegram News

Date: |

Telegram desktop app: In the upper left corner, click the Menu icon (the one with three lines). Select “New Channel” from the drop-down menu. The optimal dimension of the avatar on Telegram is 512px by 512px, and it’s recommended to use PNG format to deliver an unpixelated avatar. Ng, who had pleaded not guilty to all charges, had been detained for more than 20 months. His channel was said to have contained around 120 messages and photos that incited others to vandalise pro-government shops and commit criminal damage targeting police stations. Deputy District Judge Peter Hui sentenced computer technician Ng Man-ho on Thursday, a month after the 27-year-old, who ran a Telegram group called SUCK Channel, was found guilty of seven charges of conspiring to incite others to commit illegal acts during the 2019 extradition bill protests and subsequent months. Image: Telegram.
from us


Telegram C++ and other lectures
FROM American