814,905 questions
5
votes
2
answers
91
views
Is there any way of abbreviating long template parameter lists in C++?
Is there any "aliasing" way of shortening parameters lists like these?
template <typename TA, size_t NA, typename TO, size_t NO, typename ... T>
House<TA, NA, TO, NO, T...> ...
Advice
0
votes
8
replies
97
views
I made a simple crash algorithm, can you take a look at it?
I came up with this idea while studying math, and I made it with Gemini. The basic idea was I, and Gemini came up with the idea of drawing the rate of change of c, and then it was related to game ...
1
vote
1
answer
43
views
Unexpected behaviour of boost::find_all_regex?
Should boost::find_all_regex match two overlapping words like in the example below? Only two "two" are matched as far as I tested for the string "twonetwo" (note the overlapping &...
-1
votes
1
answer
95
views
Why does a stack overflow error occur even though the array is in global space?
Why does a stack overflow error occur even though the array is in global space?
I tried different options for creating a bitset.
The error occurs when the program is launched (before entering data ...
-4
votes
0
answers
57
views
Meaning of bits in memory based off type in C++ [duplicate]
I'm reading Bjarne Stroustrup's third edition beginner book, "Programming Principles and Practice Using C++", and in section 2.7 "Types and objects" he states:
The meaning of ...
0
votes
0
answers
38
views
How can I create a toolbar on pure WINAPI without icons?
I need to create a toolbar with texts only (without icons).
I have tried to do that, but the toolbar has appeared without anything (only gray strip on the top part of my window).
The program is below.
...
Advice
1
vote
21
replies
138
views
Text Editor in C++
I study at university right now and I want to develop a text editor as a course project. I want to make it CLI-based (as Ed, but with more laconic commands).
But the problem is that I can't use ...
Advice
0
votes
11
replies
80
views
Trying to make a command similar to "time" in Ubuntu using C++
I am trying to make a command similar to time in Ubuntu that will give me the time taken by the command which follows it on the command prompt.
My logic here is to use fork to create a duplicate ...
-1
votes
0
answers
111
views
How do I link C symbols in my C++ program? [closed]
I'm working on a C++ project to process 3D meshes. (https://github.com/blackears/cyclops_tetrahedralizer). I want to add a public domain C file that implements some advanced floating point ...
-3
votes
2
answers
90
views
How to create a member function for map?
First of all, before downvoting me please consider that I do not know anything what should I do.
I have created a map like this:
map<string, map<string, map<int, vector<int>>>> ...
1
vote
1
answer
108
views
Static inline variable defined in header is being initialised more than once
I was under the impression that static inline variables are only initialised once:
// foo.hpp
#pragma once
#include <string>
#include <chrono>
static const inline std::string FOOBAR_DIR =...
-3
votes
1
answer
57
views
initialize a map with lambda functions as values [closed]
I am trying to initialize a map in a contructor function of a factory class. The map has strings as keys and lambda functions as values. The lambda functions are themselves constructor to other ...
Advice
0
votes
8
replies
104
views
Every full-expression that appears in its initializer
The question concerns one of the old rules regarding constant initialization in C++11.
The topic has been fully analyzed (including C++26); I just need to tie up a loose end regarding one specific ...
5
votes
1
answer
118
views
Switch from C++20 to C++23 forces instantiation of template functions where unique_ptr with a forward declared type is involved
Consider a simple example of a translation unit (see on godbolt.org):
#include <memory>
struct B;
/// This template is never used in this translation unit, but somehow it's instantiated.
...
Advice
0
votes
3
replies
70
views
about private copy/move ctors, operators, etc
I've recently been backporting some Qt software to build against Qt 5.9, which (among other things) meant finding a solution for the fact that Q_DISABLE_MOVE(class) and the combined anti-copy+move ...