Re:C99/C11 dynamic array that mimics C++'s std::vector
by swift on Saturday January 07, 2017 @01:29PM
(#13345694)
These are fair points and issues like these are why many larger projects have their own custom vector-like classes. One thing I did want to call attention to is your point that C++ best practices require that objects be in well-defined states except inside methods. That's true, although it's not a language requirement, but in many cases you can get the best of both worlds through the use of lambdas. A simple example to give the flavor:
This is the standard pattern you use for such things in functional languages, and it works very well. The idea is to ensure that intermediate states are only seen by code that explicitly expects to handle them.
[ Parent
| on HN ]
There are no comments on this comment yet.