814,867 questions
6
votes
1
answer
121
views
Copy constructor is called with result of rvalue conditional operator [closed]
According to cppreference, value category of conditional operator in c++ depends on categories of the operands, namely: if both operands are lvalue, then conditional operator is also lvalue, otherwise ...
3
votes
1
answer
70
views
Where does the spurious "-O0" gcc flag come from when compiling my R package that uses Rcpp?
I use Rcpp in my R package.
I have a src/Makevars file, where the only modification in the variables is:
PKG_CPPFLAGS=-I. -I$(FUZZYCOCO_SRC) -UNDEBUG
PKG_LIBS= mylib.a
When I compile my package using ...
-2
votes
0
answers
47
views
Problems using C++ Dll when running C# UI Application
I recently met with a curious problem when using C++ Dll when using C# application
"System.BadImageFormatException: 'An attempt was made to load a program with an incorrect format. (0x8007000B)'&...
-2
votes
2
answers
110
views
Visual Studio 2022 (v143) std::views gets error "name followed by '::' must be a class or namespace name"
My Visual Studio 2022 (v143) refuses to compile this code below due to an error:
name followed by '::' must be a class or namespace name
#include <iostream>
#include <vector>
#include &...
0
votes
0
answers
33
views
Bundler option to use older Ruby headers?
I am running some old ruby code and it misbehaves with the latest versions of some dependencies. I can change the dependency version in the Gemfile and then ask bundle to install the dependencies.
The ...
-5
votes
2
answers
93
views
C++ compiler for Linux [closed]
I would like to ask about some C++ compilers for arch based linux that you use. I heard about gcc once. Is it that good or can you recommend something better?
I haven't tried any compiler on linux yet,...
1
vote
1
answer
118
views
Can we use custom formatters for std strings?
I wish to add a custom std::string formatter, so it takes precedence over the default one and I don't have to use formatters for custom types like std::format("{}", Upper(s)).
#include <...
1
vote
0
answers
64
views
Do I have to make a separate library if multiple CMake targets need to use a C++ module?
I have a whole bunch of static libraries, and many of them need a c++20 'json-module' I made. So I do:
target_sources(lib_OS_interface_and_gui
PRIVATE
FILE_SET ...
-1
votes
0
answers
56
views
Rotating an OpenGL FBO by small increments each frame [closed]
I'm trying to add "trails" to existing elements on screen using an FBO as a pseudo accumulation buffer. I fade these trails out in the fragment shader:
sampled.w -= (1.0 / intensity) * ...
2
votes
1
answer
47
views
How to make QProgressDialog responsive while avoiding all user input
I have an operation that does a lot of ui updates and can take a long time.
I want to make sure to show a progress bar and be able to handle a cancel button while this is running. I don't want any ...
3
votes
2
answers
147
views
Is the dynamic initialisation of non local static/global objects inherently thread-safe?
The dynamic initialization of a global object (static storage duration) might be delayed until "something" of this translation unit is (odr) used. This implies that multiple threads may ...
2
votes
1
answer
63
views
Building Qt6 with g++ 15 and std c++23
I am trying to build Qt 6.8.2 with g++ 15 and std standard c++23. This is my configuration command:
$ export GCC_CC=/usr/bin/gcc-15 \
GCC_CXX=/usr/bin/g++-15 \
GCC_CFLAGS="-O2 -fPIC" ...
9
votes
0
answers
104
views
Out of line definitions for members of constrained partial specializations
MSVC doesn't accept this code, even the latest version on Godbolt:
#include <type_traits>
template <class R>
struct A {
A();
};
template <class R>
requires std::is_reference_v&...
1
vote
0
answers
127
views
Why can out-of-memory conditions lead to access violations and stack overflows?
The following code uses Process Governor to restrict its memory use to 1 MB. It then allocates several megabytes of memory in a vector of strings, so I expect std::bad_alloc to be thrown (in strings....
-3
votes
1
answer
90
views
String defined in header A is not defined in header B [closed]
I have 2 header/C++ files (4 files total) where I define some constant strings. When I reference a string from headerB in headerA, it complies fine, but it crashes when run because headerB::noteB is &...