On 12/05/16 12:05, David Topham wrote:
> Probably this has been asked before but I couldn't find the thread searching...
> Although I know we can always add c_str(), I am curious why FLTK
> functions do not take c++ string objects?
Mainly to prevent fltk from having a dependency on stl.
This allows fltk to be built and run on systems like embedded hardware
that have minimal compilers that can handle c++, but /can't/ handle
advanced templates that stl needs.
Which is why fltk continues to use C strings instead of
std::string or std::<anything> internally.
This way fltk can have a consistent API across all platforms.
While we /could/ add optional convenience methods to fltk
that accept and return std::string definitions, this would
just hide the fact that fltk is still using C strings internally.
Better to expose the library's internal data to expose the most
efficient data path possible, rather than try to hide it with
convenience methods. This way the app can choose the most efficient
techniques for moving data possible, to avoid efficiency issues later.