8

Rant C++
Why do some people like to use ALL the language features. lets use "auto" en "std::tuple" and "std::tie" to hook everything together.. I cannot put something In a list because I now have to use std::move. SURE! If for every line of code I need to lookup what things were again or fixing compile errors it breaks my flow. "std::bind" this and Template that. half of the stuff you don't actually need.. it just complicates things..

Not all are bad. Only Unnecessary sometimes.

Comments
  • 2
    Yeah, the STL is massive and the general workflow gives the impression that C and high abstraction don't mix well.
  • 5
    Because I like using a
    std::vector<std::map<std::pair<std::string, std::deque<std::string> >, std::list<std::vector<int> > > >
    data structure unironically :p
    And it's actually so damn satisfying to slap a ::iterator in front of that horror and have it work because STL is so damn well designed.

    Curious where you're having to use std::bind though.
  • 4
    @RememberMe I'd say std::bind is pretty normal when you want to pass a callback but discard the result, or add placeholders to some params that your callback uses. It can save you a whole connector function. But only if neither the callback, nor the host are from a C api, because those don't work with std::callable or whatever the interface is called.
  • 2
    Because devs were underused and bored in the project so that they made it more challenging by introducing a lot of garbage. Incidentally, that's also how C++ arose in the first place.
  • 2
    I Agree with @Lor-inc

    std::bind and the whole <functional> really make C++ more usable these days. Its easier to use bind than to pass around bunch of function pointers or designing a custom interface for this

    std::move can also bypass some ugly memory logic so the code looks neater

    std::tulple is more of a convinience, if you know what touples are then its also more readable than structs or custom classes

    I don't think I ever used ::tie!

    One really cool one is std::variant, which is just a fancier and safer union.

    But I get what you're saying. C++ has become heavily experience oriented and It's almost impossible to read or debug unknown code without the docs handy. I don't necessarily think that's a bad thing though, all those std:: functions are not needed, but once you know them, they can reduce the amount of boilerplate dramatically
  • 0
    You're jonesing for first order intermediary encapsulation and some logical destructuring assignments, but you're in C++ so you do what you can.
  • 0
    @Lor-inc yup, callbacks and EDSLs are pretty much where I've used bind too.
Add Comment