Telegramy
Articles
About
« Rev
@programminginc
736
Fwd »
klimi
hmmm
klimi
it was sadly a joke
klimi
butttt
klimi
if you want
klimi
i can do something
Anonymous
i can do something
yeah , banana pies please XD
klimi
pies... hm
klimi
pie s ?
klimi
okay
klimi
come over
klimi
how do i create arrays in c++ ?i forgot....
Anonymous
pies... hm
yeah pies , not πs
Anonymous
how do i create arrays in c++ ?i forgot....
type name[]
klimi
and if i want to do 2d or 3d?
BinaryByter
how do i create arrays in c++ ?i forgot....
use std::array
klimi
use std::array
whats that?
BinaryByter
and if i want to do 2d or 3d?
make an array of an array
BinaryByter
whats that?
a wrapper around arrays
klimi
okay
klimi
i want to program my algorithm
klimi
so
klimi
i need testing array
Mihail
and if i want to do 2d or 3d?
type name[][] or what maxi said
Hayk
i want to program my algorithm
Which?
klimi
ill do maxi thing
klimi
Which?
i though at my czech class one algorithm that could save cca 60/61 of my render time
klimi
@linuxer4fun so how would be 3d array?
BinaryByter
std::array <std::array <type, size>, size> myarray;
klimi
wha
klimi
why is it so ugly
BinaryByter
it is not
klimi
weell
klimi
type name[][][] is more nicer
BinaryByter
type name[][][] is more nicer
not, when you understand the underlying stuff
Anonymous
why is it so ugly
xD
BinaryByter
type [][] is a pointer of pointers
klimi
not, when you understand the underlying stuff
no one cares
BinaryByter
and pointers get dirty quickly
Mihail
why is it so ugly
array of array
klimi
oh ok
klimi
ill do that
klimi
maxi and 3d array?
Mihail
type [][] is a pointer of pointers
which is technically this
Mihail
maxi and 3d array?
add one more std::array
BinaryByter
maxi and 3d array?
just add one more array
klimi
std::array<std::array<std::array?
klimi
and how do i access it?
Mihail
std::array<std::array<std::array?
yes
klimi
thats super ugly
Anonymous
thats super ugly
just take 3 seconds to look at it and it won't look as ugly as the first second
klimi
std::array<std::array<std::array<int,3>,3>3> map;
klimi
vs
klimi
int map[3][3][3]
klimi
YOU WERE WRONG PEOPLE
klimi
std::array<int,3,3,3>
BinaryByter
what?
BinaryByter
no, that won't work
klimi
why not
klimi
// 3-dimensions, this begins to get out-of-hand int _c[2][2][2] = {{{3, 3}, {4, 4}}, {{5, 5}, {6, 6}}}; array<int, 2, 2, 2> c = {{{{{3, 3}, {4, 4}}}, {{{5, 5}, {6, 6}}}}};
klimi
https://stackoverflow.com/questions/43628497/3d-stdarray-in-c
klimi
god dammit
klimi
@linuxer4fun
klimi
Ariana
slightly cancer XD
klimi
mhm
Mihail
you should reduce the brackets i think
klimi
it
klimi
compiles
Ariana
Or access elements by like i*len+j
klimi
[kurimi@KlimiStation ~]$ g++ optimalization.cpp -std=c++17 -Werror [kurimi@KlimiStation ~]$
Ariana
(i*len1+j)*len2+k
Ariana
etc.
klimi
i get it
klimi
but
klimi
they say that std::array is better
klimi
and i just need some data for testing my algorithm
Mihail
they say that std::array is better
i think it's just a wrapper around normal arrays
klimi
shrug
Ariana
i think it's just a wrapper around normal arrays
yeah
Ariana
I need a std::tensor XD
« Rev
@programminginc
736
Fwd »