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

How to print Eigen tensor EVERY iteration?
 
I made an older post about printing an Eigen tensor into a text file and where the example I am using here isn't really ideal, it ended up working for me throug...
[5 replies] Last: @mbozzi Thanks A LOT! This is perfect. (by JamieAl)
File stream read in error
 
Hello! Context: I am making a simple code to read in a maze from a file the maze should look like this: 5 5 .S.#. ##.#. ..... .#### ....F but instead, it lo...
[2 replies] Last: Thank you and also I added the code tags ty for the article (by kailarob)
how to prevent duplicate when compare 2 string vector.
 
#include <iostream> #include <vector> #include <random> #include <algorithm> #include <iterator> #include <ctime> #include <set> using namespace s...
[5 replies] Last: It has been a while since I have used c++. The forum format has change... (by oggin)
by Cplusc
elseif condition in macro
 
anyone knows why I am not getting the _dim and _nnodeLtc correctly from the following piece of code? #pragma once #ifndef _INCLUDES_H_ #define _INCLUDES_H_ #...
[13 replies] Last: thanks for your answers. (by Cplusc)
how to print Eigen tensor to text file?
 
I am trying to print a 3D matrix into a text file and use it to make plots in MATLAB. I have been using std::ofstream("3DTest.txt") << Test; for all my Eigen ...
[6 replies] Last: The issue is this is readable as 16x256 instead of 16x16x16. Same ... (by lastchance)
sort option needed
 
which sort (bubble,quick, merge) option best suited here? 1)A list sorted except for one item, which is in wrong place? recursive merge sort??
[12 replies] Last: Better to use the C++ library for most uses of sorting instead of rel... (by keskiverto)
Error when taking max value of Eigen tensor
 
I am trying to get the max value of an Eigen tensor, something equivalent to max(max(max(T))) in MATLAB. The thing is I got a case that works for me: stat...
[4 replies] Last: @lastchance Thanks! I am confusing myself A LOT because I am using MA... (by JamieAl)
How to do dynamic scoping
 
How come not able doing a dynamic scoped variable, how to do dynamic scoping in c++ as this illustration fails: void f(int i); void fn(int& m){ int i; ...
[6 replies] Last: Respectfully @abdulbadii I don't understand why you don't want to use ... (by Geckoo)
inline assembly
 
hello all , i make hook to read some address from ebx to this value all work good But every time the same address is printed, I'm sure there are many address...
[no replies]
Output inside function mismatches outside function
 
Why does my function returns zeros when called in a script but then if I try to print out the output "inside" the function I get the correct results? I am confu...
[2 replies] Last: @JLBorges oh I see. Thanks! (by JamieAl)
One explain on initializing each vector argument.. please
 
one outright understand definitely each vector argument in initialization (v) ? enum Mon : int { A = 5, B, C }; struct M { explicit M(Mon m, M...
[2 replies] Last: When posting code, please use code tags so that the code is readable ... (by seeplus)
by t im
Virtual function and class inhertance
 
I'm confused about the code below: class A { public: A() { bar(); }; virtual ~A() { bar(); }; virtual void foo() { cout << "1"; return; } virtual vo...
[4 replies] Last: Truly grateful for all your help. I get it. (by t im)
by t im
About std::move string and int
 
string s1 = "str"; string s2 = move(s1); // s1 is empty int num1 = 1; int num2 = move(num1); // num1 is still1 Just as the code above, why does the st...
[5 replies] Last: Thanks for all your relpy. I get it. (by t im)
by t im
Const with function
 
What is the difference between 'const' before and after function name in the code below: const int foo() // const before { return 1; } int main() ...
[5 replies] Last: I guess I must have misread the question because I ended up answering... (by Peter87)
How to copy data to an Eigen tensor?
 
I am trying to copy the output of an array after taking the 3D FFT to a complex Eigen tensor and I am not sure how to do it correctly. Example: static const ...
[3 replies] Last: @mbozzi wow! I mean, I almost gave up on this particular issue. Thanks... (by JamieAl)
What's this using usage on a class name
 
what is using for a class name scoping the name too ? as read one's code class T { public: virtual int m(); //.. } struct M : public T { using T::T; ...
[1 reply] : You are inheriting the constructors from T. https://en.cppreference.c... (by Peter87)
Help ensure/confirm type of..
 
The type of array index is std::size_t isn't?
[3 replies] Last: Note that if you have an index of type int and are comparing it's valu... (by seeplus)
issue with code
 
Can anyone tell me the issue with below code? will it be segmentation fault? #include <stdio.h> int main() { ...
[2 replies] Last: The type of str is const char* (pointer to const char) and not char*. ... (by seeplus)
How to take 2D FFT of 3D matrix?
 
I am using eigen tensor to define my 3D matrix and would like to perform a 2d fft on it. Originally, I was trying to follow with my other code where I take 1d ...
[12 replies] Last: So, this works for 3D FFT for a sine test function and I will be doubl... (by JamieAl)
WPA2 Handshake extract hash value?
 
Hello there, i recently wrote some lines of C++ code to read in wordlists, to chunk them up into smaller ones and to crack a hash value by calculating and co...
[no replies]
October 2022 Pages: 123
  Archived months: [sep2022] [nov2022]

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