Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "std::vector"
-
In C++ we don't say "Missing asterisk" we say "error C2664: 'void std::vector<block,std::alocator<_Ty> >::push_back(const block &)': cannot convert argument 1 from 'std::_Vector_iterator<std::_Vector_val<std::_Simple_types<block> > >' to 'block &&'" and i think that's beautiful
(not mine, source: https://goo.gl/Akxjih)4 -
My Unreal project right now:
FVector
std::vector
Eigen::Vector
KDL::Vector
....
*sigh*
And people ask me why I like Lisp. A Vector is a Vector goddamit! Half my project is now just parsing the same variable to the different functions. sigh....I hate this.6 -
How can a candidate have 10+ years or experience with C++ and let alone struggle with the most simple exercise!?
Thoughts from the inner me during an actual interview:
FOR FUCK SAKE, DUDE, PUT THAT "std::" IN FRONT OF YOUR "vector" AND IT WILL COMPILE!
USE ITERATORS GODDAMMIT INSTEAD OF THOSE FUCKING INDEXES. YOUR CODE IS FULL OF DAMN OVERFLOW ERRORS!
HAVE YOU EVER REALIZED THAT ARRAYS CAN BE EMPTY SOMETIMES?5 -
Well not bad for my first try eh? I implemented a std::vector-like container and it's about 4 times as fast as std::vector10
-
Interviewing a 7yr experienced c++ guy, started with an ice breaker.
Me: when would you use std::list and when would you prefer to use std::vector
Candidate: vector for sequential elements and list for sequential but sorted elements
Me: why list for sorted elements? I didn’t say anything about sorting
Candidate: you’re rude
Real telephonic interview10 -
My last company had a code base originating in the 90's and they still write most parts of the GUI with a library that is a thin layer on top of Win32 API, with a self-rolled "ORM" for DB access (with LOTS of enums) and all that with >2million lines of C++ code. The code includes at least two implementations of std vector and std:list. One of which is even *named* std::vector. Feels good remembering that I have left that behind2
-
class XXX
{
public:
std::vector<std::wstring> m_Files; // Recently used files
why not just use:
class XXX
{
public:
std::vector<std::wstring> m_RecentlyUsedFiles;
FFS4 -
Fuck c++
Everytime I have to use this fucking language it spits up some other bullshit error
`cannot convert std::vector<int>() to std::vector<int>&`
WHY THE FUCK ARE STACK ALLOCATED VALUES EVEN THEIR OWN TYPES
AND WHY CANT I TAKE A GOD DAMN REFERENCE TO IT
JUST WHYYYYY29 -
Hey this is my first post on This new fitness-tracker-app community
I will tell y'all my workout :)
-programming a parser
FUCKING HELL PLEASE STOP ALREADY THIS IS THE WORST SHIT IVE EVER DONE EVERY WHERE IF STATEMENTS JUST TO CONSUME FOUR FUCKING TOKENS I DONT WANT TO DIE BUT I'D LIKE THIS PROJECT TO BE FINISHED ALREADY BECAUSE THIS IS ANNOYING AS FUCK I REALLY WANT TO KICK MY COMPUTER WHILE TELLING IT TO BE THE MOST STUPID BRAIN ON THE WORD AND THEN REMEMBERING THAT ITS NOT A BRAIN FUCK MY FUCKING FUCK HELL THEN I WOULD KILL THE PEOPLE WHO THOUGHT THAT MAKEING std::vector::end() RETURN AN ITERATOR WITHOUT ELEMENT WAS FINE AND THEN I'D KILL ALL THOSE WHO COME INTO MY ROOM THUS DISTURBING MY WORKFLOW
Enough rage.4 -
Best way to deal with office politics?
As background: we have our own implementation of some C++ data structures, including an "Array" class (basically the same as std::vector).
A few years ago, the senior guys on my team refused to add new features to it for (seemingly) no good reason.
So senior guys from another team added the features anyways, in THEIR repo.
My team couldn't stop them, but refused to allow the new features in OUR repo, so now our Array is split between two repos for no good reason 😢.
Two years later, here I am, hoping to clean this up. As far as anyone knows, there's no good reason to have it split up like this.
How do i convince my team that we should move the code to OUR repo where it belongs?7 -
Getting hard time to understand std::vector and even more confusing with multidimensional vector.
Going back to array. 😪4 -
The crazy shenanigans you can do with C++ standard libs are fascinating.
Like implementig multithreading with just a foreach, and bindings which can make member function pointers to simple function pointers, and placeholders in bindings. Also lambda functions are cool.
Something between the lines:
my_crazy_class *tmp = new my_crazy_class(...);
std::vector<type> my_array = .....;
std::for_each(std::execution::par,my_array.begin(),my_array.end(),
[&](type in){
auto fn = std::bind( &my_crazy_class::my_crazy_fnc,*tmp,_1,random_static_value);
return fn(in);
});
ps:
It's pretty much pseudocode, and please don't do things like this, it's bad for your mental health.
pps:
I need to learn how to use this tools wisely. -
Allright, to settle a debate what is the more incorrect way of getting the last elememt of a std::vector?
Is it this:
auto i = myVec.at(myVec.begin() + myVec.size() - 1);
or:
auto i = *(&myVec.at(0) + (myVec.size() - 1));
I think the second method is better(worse) because it has more brackets and only works on Implementations where the vector's data is laid out concurrently (that is in the c++11 spec, but I've seen some shit)
My friend argues for the first method because it takes more time. (If IO is not a bottleneck)1