General C++ Programming - September 2022

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...
[4 replies] Last: ... and there are a few decent libraries around on public git repos no... (by kbw)
Is md5 input plain limited to 32 chars ?
 
Hello all, in cannot understand why you can pass more than 32 characters into the md5 hash function. Ive seen the Implementation of mfontanini ( https://github...
[11 replies] Last: I use the MD5 from openssl. md5.hpp #pragma once #include <openssl/... (by kbw)
by new1
Random hex code generation saving
 
Hi, I'm trying to generate a hex random generators and catch it in 2d array. ex o/p random hex: 0x12 0xff 0x34 0x3e 0x00 0xef 0x01 0x43 0xb3 .. .....
[6 replies] Last: Is there any better way for generation of hex As jonnin mentions if ... (by deleted account xyzzy)
by Cplusc
get a digit of an enum
 
hello forum I have a enum data type which is enum Type { D1Q3, D2Q9, D3Q19, D3Q27 }; The first number is the dimension of my problem and the second n...
[10 replies] Last: I really do not understand why the language is still missing simple en... (by helios)
ranges split
 
This code works as expected and produces the expected output: #include <string_view> #include <ranges> #include <iostream> #include <vector> #include <iomani...
[8 replies] Last: For info, we've decided to use: template<typename T = std::string_v... (by seeplus)
by t im
About multi level pointer
 
Here is a code about multi level pointer: double* (*a) ; cout << sizeof(a) << endl; // 4 cout << sizeof(*a) << endl; // 72 cout << sizeof(**a) << endl...
[2 replies] Last: Thanks a lot for your detailed reply. I got it. (by t im)
How can I create a concept that tests for specialization?
 
Hi, I want to create a concept that can only be applied to std::vector<T> for any T... Some predicate like is_specialization_of ... Thanks
[4 replies] Last: Maybe in C++26... (by seeplus)
by t im
Decompose Number with Prime Factor
 
Given a number n, Here are two operations can be taken: * n - 1 * n divide by its prime factor Question: In order to decompose n to 1, what is the minimal o...
[6 replies] Last: Oh, I misread that. (I’m bad at that, it seems.) (by Duthomhas)
Need g++ all compilation work files in some location
 
How do we put gcc/g++ all compilation work files in other certain directory ?
[1 reply] : The location and the names of auxiliary and dump outputs can be adjust... (by JLBorges)
Error in copying element of one array to another in C++
 
This is a very simple issue that for some reason I am not sure why I keep getting wrong. I am basically trying to copy array ``n`` to array ``dummy`` as the fol...
[6 replies] Last: You can do the copy with something like [ ] real_buffer from_plain_... (by mbozzi)
Loop by use of `:` specification and/or definition
 
What exactly is a c++ loop by use of : definition, how define its upper limit? is its equivalent to the common loop for (int i=0; i<5; ++i) { cout << i ; } ...
[3 replies] Last: As described in that cppreference page, the for ( int i : n ) { cou... (by keskiverto)
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. ...
[8 replies] Last: When we did this at Univ in the dim and distant past, we had the examp... (by seeplus)
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)
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)
September 2022 Pages: 1234
  Archived months: [aug2022] [oct2022]

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