Beginners

by admin
Welcome -- read before posting!
 
Welcome to the beginner's forum in C++.com! In this forum, users can to talk about any topic relate...
[2 replies] Last: How To Answer Questions in a Helpful Way Be gentle. Problem-relat... (by admin)
Console Closing Down (1,2,3,4,5,6,7)
 
Hi, i am new to C++ and have just written my "Hello World" program. It worked all right but the cons...
[120 replies] Last: It displayed "Hello world" after you pressed Enter. int c is a ... (by Duthomhas)
by Ganado
Pretend my unique_ptr is a reference?
 
I have code that looks like this: std::unique_ptr<Foobar> pFoobar = FoobarFactory(); Foobar& foobar...
[1 reply] : I thought of having a wrapper class like this: template<typename T> s... (by Ganado)
by Ganado
Access specifiers in nested class
 
This is probably a really basic question, but I'm confused by why this code compiles class Foo { p...
[2 replies] Last: Thanks Peter. (by Ganado)
by Mif
C programming. "Using #include inside array initialization"
 
Hello again.. I just want to know if the syntax bellow is valid.. I tried to initialize an array wit...
[16 replies] Last: Yup.. it is. Okay this being said.. I'll pass over and mark this as so... (by Mif)
Logging Wrong Line Number
 
I'm working with C++17 or prior. I'm writing a custom logger class (I don't have access to a loggin...
[5 replies] Last: [quote=kigar64551]#ifdef CUSTOM_LOGGER #ifdef CUSTOM_LOGGER # define ... (by ElusiveTau)
by Ch1156
Is my understanding of pointers correct?
 
So I've been studying pointers and really trying to learn how to use them and how they work, and I...
[19 replies] Last: I have just discovered that [ ] can be applied to type constructors ... (by TheIdeasMan)
Getter for enum member returns a copy of enum?
 
I came across something non-intuitive, found a solution, but don't fully understand why the solution...
[11 replies] Last: My view with regard to interface and not needing setters and maybe nee... (by TheIdeasMan)
Using of voltile qualifier
 
Hi, Where should i use volatile keyword in cpp? I wrote a code in cpp which communicating with a me...
[3 replies] Last: [quote=ElusiveTau]In multi-threaded applications, volatile can be used... (by Peter87)
by Ch1156
Using std::variant to reduce getter and setter clutter
 
I'm experimenting with new ways to reduce code bloat, and one of my biggest gripes is always having ...
[18 replies] Last: Just on the C++ language, IMO it does seem a pain that things take so ... (by TheIdeasMan)
C++ and the Government
 
Could anyone care to comment on the following? https://www.theregister.com/2024/11/08/the_us_govern...
[4 replies] Last: you use what the government tells you to if you work for them, directl... (by jonnin)
by Ch1156
Is this how you do object chaining?
 
Im learning about object chaining and im wondering if im doing it correctly. #include <iostrea...
[9 replies] Last: Thank you for all the replies! That seems like a straight forward conc... (by Ch1156)
Programming math - polynomial class
 
How to write templated polynomial class I would like to have overloaded operators like + ...
[8 replies] Last: A wouldn't make this a template, unless you need it to work with float... (by dhayden)
stack and heap
 
Hi, I have some programming concepts question: Why is stack (in context of stack and heap) co...
[9 replies] Last: What question, exactly? Weren't here plenty of explanations ("solution... (by keskiverto)
by zzzhhh
Should the subscript "opt" be dropped in the definition of "array of N T" in the standard?
 
This is the definitive syntax of "array of N T" in C++ Standard https://eel.is/c++draft/dcl.array#1 ...
[3 replies] Last: Hi Is it because the array bound may be omitted when there are initia... (by TheIdeasMan)
by zzzhhh
Where is const mandated in the Standard when binding an lvalue reference to an rvalue?
 
I'm reading the part of the Standard about initializing an lvalue reference from an rvalue (https://...
[1 reply] : I don't think I've ever actually read the standard in over 30 years of... (by seeplus)
by zzzhhh
Which item stipulates that A() is a prvalue?
 
class A { ... }; A(); This webpage lists all possible forms of prvalue expre...
[2 replies] Last: I believe that A() is a function-style cast expression and is covered ... (by mbozzi)
How to compare int class template value?
 
I'm aware I should use std::string but this is question is about using template specialization a spe...
[2 replies] Last: 2. That's a good point. Only up to MAX_CSTR_SIZE-1 bytes will be copie... (by ElusiveTau)
Template errors creating a map<int,std::thread> using map::emplace
 
I created a class to try out std::lock_guard. The first function, UnsafeExample compiles and run...
[2 replies] Last: Thanks Peter. That was it. 1. std::ref(coutMutex) was necessary, for ... (by ElusiveTau)
How to initialize base class member with subclass member?
 
I'm working with code where CustomThreadApi is not modifiable. CustomThreadApi has a ctor that tak...
[2 replies] Last: baseClassBuff is unnecessary. I can just reuse MyThreadClass.Name .... (by ElusiveTau)
  Archived months: [jul2025]