Why the fuck does everything in C++ insist on endlessly copying shit here and there, spawning 4 (FOUR!!!) copies of some fucking object during certain calls to methods of stdlib containers (vector, tuple etc).
I can't create a fucking thread without it copying my ``functor'' object (with operator()) at least twice for some fucking reason.
So yeah, if you want fast C++ programs, you fucking write them in C, with manual handling of pointers and shit. Fuck C++.
Name:
Anonymous2013-06-13 5:41
D use a different model, every heap object is once constructed trivially copyable anywhere in memory. The trade-off is that internal pointer are forbidden by the language.
If you need aggregates that own something, D has "struct" which are akin to C++ objects except for simpler move semantics.
That said, I don't find copies in C++ _that_ annoying.
In any C++ function there is a gazillion temporary copies created and destroyed every fucking nanosecond. Guess what it does to performance if you did not bother to write an arena allocator for every fucking class of yours? It fucking ruins it, that's what. Wrapping every goddamn object in a shared_ptr or a unique_ptr had cut my processing time by 45% per iteration. Fuck off C++.
>>2
But it calls both the constructor (which in C++ must not be anything non-trivial, that is, the constructor MUST be trivial) and the destructor. If you have some cleanup logic for reference members in your destructor, good fucking luck finding which of the copies releases this or that resource.
So it's C all over again: you have the constructor, the init function, the finalize function, and the destructor.
Thanks for mentioning D, I will give it a try for some of my personal projects when I have more time, meanwhile I'm going back to destroying my brain with C++ on my day job
Because the language can't make any assumptions about what your objects contain, it must use the construct/assign/destruct sequence. The standard library containers are very generic and while your case might not require the copying, it might not work in all cases. If you want a non-copying vector, you write it yourself. C++11 has some features that could help.
>>5
employee Name Job Salary => | name => Name | job => Job | salary => Salary
ListOfEmployees = list employee \Cirno [ice witch] unemployed
| employee \Reimu [shrine maiden] self_employed
| employee \Cudder [gay whore] low
say employees sorted by salary are: ListOfEmployees sort by salary
Name:
Anonymous2013-06-13 11:05
>>1 I can't create a fucking thread without it copying my ``functor'' object (with operator()) at least twice for some fucking reason.
Why don't you pass your functor by reference?
How much state does your functor have -- if it doesn't have any then you probably shouldn't worry so much because copying a zero-size value-allocated object generally costs less than your mum's blowjob.
Name:
Anonymous2013-06-13 12:19
>>10
Reimu has a formal job with no reliable income source, and please don't speak ill of Cudder-氏.
Not using move constructors.
Not compiling with -O3 to inlinr everything
Maybe you should play with Java like a little kid you are? Leave C++ for serious men for serious business.
>>26
It's stdlib that is not using move constructors, dipshit. C++ copies everything by default because it is a shit language, and your gay bear club of ``serious men'' is nothing but a circlejerk of uglies who love to memoize annoying details of their basic instruments.
>>31 who love to memoize annoying details of their basic instruments
that means we're smarter than you broskie ;)))
Name:
Anonymous2013-06-14 20:24
>>31 copies everything by default
Because C/C++ has no garbage collector, so the only way to maintain ownership is by copying crap into a parent stack frame.
C/C++ also has long shutdown times, because of a lot of free calls in destructors and malloc managing scheme being inherently inefficient.
Name:
Anonymous2013-06-14 21:04
>>32
It also sounds like a female name. I bet she's conspiring against the sepples kikes. Good, I want to hear explosions in the Google headquarters. Girls that strap bombs to themselves make me horny, which is why I love Ichirin so fucking much.
Allahu Ackbar.
----
لَا إِلٰهَ إِلَّا الله مُحَمَّدٌ رَسُولُ الله There is no god but God, Muhammad is the messenger of God.
[u[PUT THIS SHAHADAH IN YOUR SIGNATURE IF YOU WANT TO BOYCOTT ISRAEL[/u]
C/C++ also has long shutdown times, because of a lot of free calls in destructors and malloc managing scheme being inherently inefficient
The Value Grinder might disagree, but that's easily solved by just letting the OS blow away the whole process.
Name:
Anonymous2013-06-15 15:50
need to thrown out from C++:
1. all OOP,
2. overloading, including the operators
3. referenses,
4. templates
5. exceptions
add LUA as standard library
and replace preprocessor to PHP
that's all
Name:
L. A. Calculus!!wKyoNUUHDOmjW7I2013-06-16 0:23
>>43
I STOLE PHYSICAL COPIES FROM DA ISO BACK IN DA DAY. DONT GOT NO ELECTRONIC COPIES, BUT U CAN GET DA DRAFTS EASY AS SHIT IF YOU LOOK AROUND. IT'S DA SAME SHIT ANYWAY, SO WHO GIVES A FUCK.
Name:
Anonymous2013-06-17 14:31
We have a guy that demands that we write out every trivial detail of copying this or that or marking this or that as const as if it improves the quality of our software. We have to do that because the guy is the butt-shoving prostate massager, I mean, byte-saving project manager
When you have "automatic" memory management but no GC, you have to make copies. You could try reference counting, but it doesn't work with cycles.
Name:
Anonymous2013-08-27 15:15
How are you measuring this ``copying''?
If you're putting a print statement in your copy constructor then it's no surprise it's forced to call it since you made it have side effects.