BinaryByter
google will help you a lot when learning
Anonymous
BinaryByter
sure :)
Mat
Another thing that will help you. Read your ide's messages. If you read carefully this image, you'll see a suggested alternative right there.
Mat
It's not for fun, it's actually a good advice for you. And you'll need those messages to ask people what's wrong with your program
Dima
lol
Anonymous
xD
BinaryByter
thats why nobody gave an answer
BinaryByter
because the question was badly asked from the beginning
BinaryByter
and people won't help you if you don't help them for helping you
BinaryByter
because that usually means that you don't REALLY care about getting the solution
Anonymous
because that usually means that you don't REALLY care about getting the solution
Sry for my behavior sir got a lot of knowledge from this one error
BinaryByter
no problem :)
BinaryByter
Dudes does anybody know how to return a reference to a vector that was created inside of a function?
BinaryByter
std::move doesnt seem to do what I want ot
BinaryByter
because its faster than copying a vector of 10.000 values lol
BinaryByter
maybe returning a const reference
MᏫᎻᎯᎷᎷᎬᎠ
maybe returning a const reference
I don't think that's possible
MkfsSion
it's non-use
MᏫᎻᎯᎷᎷᎬᎠ
Unless u used constexpr as lvl
BinaryByter
I don't think that's possible
i'd like it to be ;_;
BinaryByter
MkfsSion
the memory will be released
BinaryByter
well yea but isnt there a way, using std::move to move the reference?
MkfsSion
when the function end
BinaryByter
I don't feel like using a smart pointer
BinaryByter
since that would imply that I use new
MᏫᎻᎯᎷᎷᎬᎠ
lvl?
The left hand param
BinaryByter
The left hand param
left value? how does that relate to
BinaryByter
return tempVector;
BinaryByter
?
MᏫᎻᎯᎷᎷᎬᎠ
left value? how does that relate to
U said u could return a const vector
BinaryByter
i said maybe I coudl try to
BinaryByter
but it doesnt work
BinaryByter
xD
BinaryByter
returning a const would be totally fine with me
BinaryByter
fine i'll use output arguments ;_;
BinaryByter
time to get my code stinky
BinaryByter
MᏫᎻᎯᎷᎷᎬᎠ
i said maybe I coudl try to
Try to let the lv a constexpr
BinaryByter
MᏫᎻᎯᎷᎷᎬᎠ
what?
constexpr auto v = f();
BinaryByter
I don't use a lambda
MᏫᎻᎯᎷᎷᎬᎠ
constexpr auto v = f();
Where f returns a const vector
BinaryByter
besides, constexpr != const
Anonymous
Hi friend
BinaryByter
and constexpr is not at all what I need
MᏫᎻᎯᎷᎷᎬᎠ
BinaryByter
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
Lemme try 4 u
MᏫᎻᎯᎷᎷᎬᎠ
U said u wanna return a reference of vector
MᏫᎻᎯᎷᎷᎬᎠ
U said u wanna return a reference of vector
And the vector itself should be local reference in function, right?
MᏫᎻᎯᎷᎷᎬᎠ
Let me give it a shot
BinaryByter
But u returning a const
But the function doesnt always return the same only based on the inputs to the function. so it doesnt qualify as a constexpr
AkhiL
1 23 345 4567 Print this pattern. if possible from while loop or do from for loop, i will convert it
BinaryByter
I mean I know how I could fix this
BinaryByter
but it would clog out my code ;_;
MᏫᎻᎯᎷᎷᎬᎠ
Maxi u mean function like this one?
BinaryByter
int start = 1; int pos = 0; for (size_t i = 0; i < 4; i++, start++) { pos = start; for (size_t j = 0; j < i; j++, pos++) { std::cout « pos; } }
BinaryByter
BinaryByter
I need to do it
BinaryByter
without a global variable/a variable in the main class
BinaryByter
because thats like
BinaryByter
super ugly to use later