General C++ Programming - March 2023

Potentially-evaluated expressions
 
An expression is potentially evaluated unless it is the operand of the sizeof, noexcept, typeid, de...
[19 replies] Last: [quote=malibor] static_assert is a good trick to see if it's evaluate... (by Peter87)
parsing durations using %q or %Q??
 
cannot parse durations using %q or %Q...e.g. std::chrono::duration<long long, std::milli> dur{ ...
[5 replies] Last: Maybe something like: #include <chrono> #include <iostream> #includ... (by seeplus)
parsing a formatted string
 
using the format library in C++20, and having done this: int val = 25; string str = std::format( ...
[6 replies] Last: To just obtain a number from std::string, there are the stoxxx functio... (by seeplus)
I don't understand ISO week
 
Please explain why Sunday jan 1, 2023 prints as 52 using %V -- why is that different to week 1? ...
[1 reply] : [quote=JUANDENT]week 1 starts with Jan 1 for every year... Nope. Eve... (by Peter87)
now() returns same as current_zone()->to_local(now())
 
Hi, system_clock::now() returns the same value as chr::current_zone()->to_local(now()); I expected...
[1 reply] : A quick search reveals: https://en.cppreference.com/w/cpp/chrono/utc_... (by TheIdeasMan)
Should destructors be noexcept?
 
I'm working on a library which whose classes are almost all hierarchical, problem is that if upmost ...
[13 replies] Last: There is nothing in the C++ standard that demands that this should ge... (by malibor)
Need Help to find the error
 
I have below code, for functor. But this is giving compilation error in VS17. #include <iostream...
[3 replies] Last: Now I understand, the problem. Yes thanks to both of you for the clari... (by shekharsahoo)
where can I find trim() in std C++?
 
I expected std::string to have a member function trim() but it does not. How to accomplish this?? ...
[4 replies] Last: Using ranges, then possibly something like this which will trim white-... (by seeplus)
is this object dangling?
 
hi, I have this code assert(ltrim_copy(str) == "ยข4,500.55"); // line 1 ltrim_co...
[1 reply] : it's OK and it is destroyed when assert returns. (by malibor)
Neuronal Network not working properly..
 
Dear Community, I'm wondering what I'm doing wrong when it comes to building neural networks and I ...
[4 replies] Last: You implementation is missing a "Neuron" class, "Layer" class, "Synaps... (by malibor)
how can a function name be an lvalue?
 
take this function: int abs(int a) { return a < 0 ? -a : a; } abs is supposed to...
[8 replies] Last: [quote=seeplus]In my mind (and the language lawyers will probably squa... (by Peter87)
by Cplusc
blockMesh generator
 
Following my question regarding hexahedral mesh generation in a domain using the STL file representi...
[10 replies] Last: > Actually this is not a big code at all Big enough for you to dump on... (by salem c)
Age calculation
 
With C++20/23 std::chrono and a birthdate as either type sys_days or year_month_day, is there any 'e...
[1 reply] : We've come up with this: struct Age { unsigned years {}; unsigned... (by seeplus)
by Cplusc
Building project from github
 
I'm trying to build this project https://github.com/hemelb-codes/hemelb. This project has several ...
[4 replies] Last: vcpkg is used with Visual Studio. step 1: install all deps with corre... (by malibor)
Force implicit conversion of a string literal in templated class?
 
The code below doesn't compile because string literal instead of std::string is given to construct...
[3 replies] Last: C++17! https://en.cppreference.com/w/cpp/language/class_template_argu... (by mbozzi)
by Cplusc
generate mesh inside .STL file
 
I have some STL files (usually aneurysm) and I'm using Lattice Boltzmann Method for my simulation an...
[18 replies] Last: I would strongly appreciate any idea on my way of generating mesh insi... (by Cplusc)
year_month_day vs sys_days
 
When dealing with dates - year, month, day (not times) - either year_month_day or sys_days can be us...
[9 replies] Last: [quote=seeplus]When do you get 8 for sys_days? libstdc++ (64-bit) htt... (by Peter87)
Chrono date literals
 
Since C++20 there has been the d and y literals defined in <chrono> - but no m. This seems to be ...
[4 replies] Last: I get forward thinking & future planning, but c++ has no business stan... (by jonnin)
How can I find the maximium number of decimal digits representable in a double?
 
What is the maximum precision of double? numeric_limits<double>::????? default precision is 6 digi...
[3 replies] Last: https://en.cppreference.com/w/cpp/types/numeric_limits/digits10 (by Peter87)
output will show only the end.
 
Hello everybody. I really thank you for helping me to go back to programming in C++. You know I a...
[6 replies] Last: What exactly do you want to know? Let's say your terminal/cmd has 100 ... (by Ganado)
March 2023 Pages: 12
  Archived months: [feb2023] [apr2023]

This is an archived page. To post a new message, go to the current page.