News for hackers. Stuff that matters.
Re:C99/C11 dynamic array that mimics C++'s std::vector by 72deluxe on Saturday January 07, 2017 @02:03PM (#13345898)
You do realise that STL containers fundamentally rely on templates, right?

We use loads of template classes at where I work. Our code would not be maintainable without them.

Re:C99/C11 dynamic array that mimics C++'s std::vector by jokoon on Saturday January 07, 2017 @03:23PM (#13346405)
I know, but that doesn't change the fact that other languages don't have templates and still have containers, meaning maps, vectors, etc.
Re:C99/C11 dynamic array that mimics C++'s std::vector by pjmlp on Saturday January 07, 2017 @05:09PM (#13346930)
They have simplified templates, aka generics.

The biggest difference is that templates are more expressive, allowing for compile time meta-programming.

Re:C99/C11 dynamic array that mimics C++'s std::vector by pkolaczk on Sunday January 08, 2017 @07:23AM (#13349418)
I'd rather say templates are a hack to get generics in C++, because C++ lacks real generics contrary to eg. Java, C#, Haskell or Scala. Templates used as generics are limited in a way that the typechecker can't reason about generic types, only concrete types, which leads to horrendeous error messages and makes it impossible to prove generic library code type-safety. Type templates are templates, not types.

On the other hand templates used as a metaprogramming tool fall behind any modern macro system.

Re:C99/C11 dynamic array that mimics C++'s std::vector by fjrieiekd on Sunday January 08, 2017 @07:56AM (#13349514)
Rust is getting there but still lacks type-level integers, and macros are waiting for macros 2.0. It would also be neat to have the ability to run any function at compile time, but I don't think that's in the cards.
Re:C99/C11 dynamic array that mimics C++'s std::vector by pjmlp on Sunday January 08, 2017 @10:23AM (#13350023)
True, but as someone that spends the majority of his programming time between Java and C#, with C++ only when required, I do miss their power.

Also it is way better with latest standard improvements.

Re:C99/C11 dynamic array that mimics C++'s std::vector by jimktrains2 on Sunday January 08, 2017 @07:38AM (#13349467)
Sure, and those without templates, or at least generics, aren't type-safe.