-
Why can't fprime use STL? If my device has sufficient performance, can I use STL? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Like many shiny c++ features, a project may absolutely choose to use the standard template library (STL). It is absolutely required to work with some third-party code. In F´ core, we don't allow STL simply because this code is used by many different projects some, which might choose to use STL and others that do not. The reasoning behind this is because the STL uses dynamic memory management to allocate memory for the object stored in things like the There are ways to offset these allocations. A simple method would be to preallocate sizes for STL construct ... but STL may reallocate those anyway resulting in more memory allocation. Alternatively, one could create an STL-allocator implementation that delegates to an F´ buffer pool (BufferManager) but this hasn't been proved before. In all things, your project should trade the risks of using the STL with the benefits of using. Let me know if you would like some elaboration. |
Beta Was this translation helpful? Give feedback.
Like many shiny c++ features, a project may absolutely choose to use the standard template library (STL). It is absolutely required to work with some third-party code.
In F´ core, we don't allow STL simply because this code is used by many different projects some, which might choose to use STL and others that do not. The reasoning behind this is because the STL uses dynamic memory management to allocate memory for the object stored in things like the
std::vector
and this runtime memory allocation violates the "no allocation after initialization" rule. Hence many projects are wary of the STL.There are ways to offset these allocations. A simple method would be to preallocate sizes for STL …