• Forum
  • General C++ Programming

General C++ Programming

by admin
Welcome to this board!
 
Welcome to the general programming forum in C++.com! In this forum, users can to talk about any topic related to programming in the C++ language that does not ...
[no replies]
What is an "exposition-only alias template"?
 
For instance at https://en.cppreference.com/w/cpp/iterator/forward_iterator: Definition of this concept is specified via an exposition-only alias template...
[2 replies] Last: well thanks (by JUANDENT)
About Base class call subclass function
 
like this code #include <iostream> class A{ public: A(){show();} virtual void show(){std::cout<<"A::Show()"<<std::endl;} void test(){show();} }; class ...
[13 replies] Last: Although this is OK, the inheritance relationship is wrong. B must inh... (by KaiTang)
creation of simple tree like structure using stl vector c++, need help : )
 
i would like to create a tree like structure in c++. since the number of children per node is arbitrary i would like to use stl vector for tree creation. ...
[7 replies] Last: N children tree may not always be a search tool, it can be organizatio... (by jonnin)
ranges split
 
This code works as expected and produces the expected output: #include <string_view> #include <ranges> #include <iostream> #include <vector> #include <iomani...
[3 replies] Last: Compiling this as C++20 or C++latest? I remember VS 2022 (and 2019) h... (by George P)
A tool to have/look the C++ interpretation from a template?
 
Is there any tool to have/look the C++ interpretation from a template form syntax to its expansion/substitution before it really gets compiled to object/binary?
[1 reply] : C++ Insights tries to do something like that: https://cppinsights.io/s... (by Peter87)
C++ template for function need be in compile time
 
is template for function changes syntax at compile time or no, e.g. template<bool o> test(int& pos, int depth) { int cnt, n = 0; bool a = (depth == 2); ...
[1 reply] : as o is a templated param, you use a constexpr if for it to be evaluat... (by seeplus)
On coming across #include <condition_variable>
 
Reading #include <condition_variable> on analyzing one's project code what is it all about without yet get into very detail breakdown ?
[3 replies] Last: The condition_variable class is a synchronization primitive that can b... (by Geckoo)
Anonymous or no name namespace
 
Anyone outright understand what the necessary and purpose of bare, i.e. no name namespace ?
[4 replies] Last: unnamed namespace is not an alternative to a named namespace. It's an ... (by Cubbi)
integer hang forever
 
I am trying to solve the below problem, but my code hangs for ever and doesn't generate any output. Not sure what went wrong here? https://www.chegg.com/h...
[12 replies] Last: Hi seeplus I was not aware about std::stoi(), until you told me. Anyh... (by leo2008)
what is the m()->v
 
On reading one's C++ code, wondering what exactly the below means (without yet finding his code line on m declaration/definition) m()->value as we kno...
[5 replies] Last: I just wanted to have an object to return a pointer to. If you want yo... (by Peter87)
by PeteDD
class member array duplicating between instances
 
I have a class which is passed an array (the address of Dallas temperature devices). The data from that array is then placed into a member array. In this exa...
[9 replies] Last: If I were to take a wild guess I'd say you ran afoul of the ODR. https... (by mbozzi)
The same to this in a compile time
 
How to have this at compile time instead for (int i = 0; i < 41; ++i) interval = 0;
[8 replies] Last: [quote=JLBorges]https://godbolt.org/z/G5oKx8hEj It should be noted th... (by Peter87)
Reading output from valgrind
 
Hello. I am writing a Monte Carlo simulation engine, and I am experiencing what I believe to be memory leaks in my software. For example, I am running a certain...
[5 replies] Last: [quote=lastchance]You have the -g flag set in your compile command: so... (by Peter87)
by helios
Graphs
 
How do you do general graph structures? I.e. those where any node in the structure can point to any number of nodes in the structure without restriction. The o...
[13 replies] Last: Yes, in my Graph structure, Node might have better named "NodeId".... (by Duthomhas)
integer sum problem
 
I am trying to solve the problem. Is my logic correct? https://www.chegg.com/homework-help/questions-and-answers/write-function-solution-given-integer-n-retur...
[14 replies] Last: Here's a couple of alternatives. #include <iostream> #include <strin... (by lastchance)
by PeteDD
Link time error - undefined reference
 
I'm at a loss (once again). In a class method, I am calling a function of the Dallas Temperature library instance which I instantiated as "OneWireBus" in anot...
[11 replies] Last: [quote=doug4]If this template function gets expanded and compiled outs... (by Peter87)
by t im
Mutex Test and Set
 
I read the code about Mutex test below: static int flag=0; void lock(){ while(TestAndSet(&flag,1)==1); //flag=1; } void unlock(){ flag=0; } And TestA...
[4 replies] Last: Thanks for your reply which makes me figure it out. (by t im)
C++ today
 
Hi everyone, I've been out of the scope from C++ for years and I would like to get back on it. I usually worked with eclipse environment what was OK about wha...
[2 replies] Last: the very best python code is usually slower than c++ (< twice as slow)... (by jonnin)
Stack
 
Please help me, lets assume that we have an empty stack in the program when executed. When I pop 2 or more it displays the "Stack is empty" a few times. How to ...
[6 replies] Last: In the best tradition - 'We'll leave that as an exercise for the reade... (by seeplus)
Pages: 123... 6
  Archived months: [jul2022]