General C++ Programming - June 2022 (Page 2)

by kbw
What is an undefined reference/unresolved external symbol error and how do I fix it?
 
It depends on where you see it, during compile or link. It means you've used something without declaring or defining it, which one depends on what you've done.
[1 reply] : Usually the error also says where the bad reference comes from. Read ... (by dhayden)
Why Have Functions() in classes? (1,2)
 
Why Have Functions() in classes? As a C only programmer trying to learn C++ I don't understand why functions() are defined inside of classes? Why is this differ...
[35 replies] Last: That only covers C++11. Better C++11 than either C++98/03 or no stan... (by George P)
Ranges overkill?
 
The latest article from Rainer Grimm ( http://www.modernescpp.com/index.php/ranges-improvements-with-c-23 ) shows examples of using std::ranges to produce a con...
[5 replies] Last: Here's a talk about std::ranges that shows better use cases. https://w... (by thmm)
by n00b1e
UnorderedMap
 
How would you implement bidirectional iterators for generic UnorederedMap class with: ++, --, < and *.
[6 replies] Last: yeah I meant == and != not < sry (by n00b1e)
Matrix Division in Eigen vs MATLAB
 
I am trying to find the equivalent of the opertaor in MATLAB: A = B/C where here A,B, and C are all square matrices with say N-by-N . So I have the foll...
[5 replies] Last: @mbozzi Thanks! This is pretty helpful actually. (by JamieAl)
A moved C++ container and MSVC++ (1,2)
 
#include <iostream> #include <vector> int main() { std::vector vec1 { 1, 2, 3, 4, 5 }; std::cout << "vec1 size: " << vec1.size() << "\n\n"; ...
[20 replies] Last: This is my take on ' valid but unspecified state ': valid : operatio... (by JLBorges)
fwrite(Buffer, sizeof(A), N, fp) vs fwrite(Buffer, sizeof(A) * N, 1, fp)
 
I have a byte array which stores a lot of struct data. When I use fwrite function, which is more efficient way? // POD struct Foo { } Foo Buffer ; ...
[7 replies] Last: If you only write as one object then you either have a successful wri... (by dhayden)
PID controller setup for each cores of the CPU
 
Dirty toerag "Walker154" edited with the spam.
[1 reply] : how many variables are in your state? This sounds like it could be si... (by jonnin)
by Geckoo
OpenGL
 
Hello everyone. I have a question about 3d development having made my own 2D engine without any dependencies. I took a look at many alternatives so as to create...
[3 replies] Last: I don't think Vulkan will make OpenGL obsolete, or that OpenGL w... (by kigar64551)
"for (int i" vs "for (i"
 
Is there any reason why choose one over the other? int i; for (i=0; i<10; i++) { // instructions } or for (int i=0; i<10; i++) { // instructions } ...
[18 replies] Last: Yeah - but in C++ a ref is just a pointer 'under the hood'... (by seeplus)
by Wallby
A predefined macro for macro recursion in c?
 
Hello, I read that traditionally recursive macros were possible in c but that is no longer the case. I was wondering.. has it even been considered to add a pr...
[12 replies] Last: Many education systems (especially in the UK) seem to teach Java as a ... (by seeplus)
by t im
About the End of Multi-level Pointer
 
Just as the code below: int a = 1; int *p0 = &a; int **p1 = &p0; ...... Then, where is the end of the pointer.
[4 replies] Last: Thanks all the answers. I got it. (by t im)
Best Design Pattern(s) to Load Binary File
 
I've got an old game data file that contains binary data and would like your opinion as to which design pattern(s) I could optimally use to load the data. Th...
[2 replies] Last: have you considered the kiss design pattern instead? Half kidding, bu... (by jonnin)
help
 
Well, to begin with you could Please learn to use code tags, they make reading and commenting on source code MUCH easier. How to use code tags: http://w...
[3 replies] Last: Ah, another "I need better code" leech shows up. They get it and then... (by George P)
by frek
MinAveRange exercise
 
Hi all, It's about a task on Codility saying summarily: Find the range (with at least two elements) in an array A (with the following specs) that contains the...
[16 replies] Last: When working on a solution, a couple of times I was quite close to the... (by frek)
by Cplusc
adding header and cpp files from different folder in VS project (1,2)
 
I had a visual studio project which was working perfectly. As far as the project contained many headers and it was sometime confusing to navigate through, I dec...
[20 replies] Last: Thank you all for your good points. (by Cplusc)
Help with Float point refrencing
 
https://youtu.be/KnCNfBb2ODQ Near the end of the video the guy mentions that to zoom infinitely you need a float point representation system. I've done resea...
[9 replies] Last: yes. the most simple, basic thing would be to use base 10 (inefficient... (by jonnin)
Does opencv have a constexpr vector or matrix container
 
I would like to do something like this for example: constexpr std::array<cv::Vec3b, 6> COLORS { cv::Vec3b(0, 255, 0), // green cv::Vec3b(255, 0, 0)...
[3 replies] Last: const std::vector<cv::Vec<unsigned char, 3> > As current, std::vector... (by seeplus)
Wandbox (Online) - How To Save?
 
Been using Wandbox online browser IDE just to practice and learn. Was wondering how can I save my code? Is there anywhere I can save so when I login I can conti...
[2 replies] Last: Using an online compiler is not the best way to learn C++ since many k... (by George P)
Struct as function parameter
 
I have been using the following way of passing a structure to a function #include <iostream> #include <cstring> using namespace std; struct datast { int a,...
[4 replies] Last: // For “in” parameters, pass cheaply-copied types by value and ot... (by JLBorges)
June 2022 Pages: 123
  Archived months: [may2022] [jul2022]

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