Request Short Link
C++ 98
C++ 11
C++ 14
C++ 17
C++ 20
C++ 23
C++ 2c
for-loops as while-loops
array subscription
Show all implicit casts
Show all template parameters of a CallExpr
Use libc++
Transform std::initializer_list
Show noexcept internals
Show padding information
Show coroutine transformation
Show C++ to C transformation
Show object lifetime
Default
15
18
20
22
26
More
GitHub
Patreon
Issues
About
Policies
Examples
C++ Insights @ YouTube
Settings
Version
Bring C++ expertise to your team? Click for details
×
Made by
Andreas Fertig
Powered by
Flask
and
CodeMirror
Source:
#include <chrono> #include <iostream> void duration_to_end_of_year() { std::chrono::time_point now = std::chrono::system_clock::now(); constexpr auto year = 2022; auto new_years_eve = std::chrono::year_month_day( std::chrono::year(year), std::chrono::month(12), std::chrono::day(31) ); auto event = std::chrono::sys_days(new_years_eve); std::chrono::duration dur = event - now; //std::cout << dur << " until event\n"; }
Insight:
Console: