FLTK logo

Re: [fltk.coredev] Consider using std::vector (C++98 / C++11)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Consider using std::vector (C++98 / C++11) Bill Spitzak Jul 15, 2021  
 
Back when fltk was created using std:: stuff was certainly much worse performance and storage wise compared to directly writing pointer manipulation like in C. However that has certainly changed over time, modern implementations especially on Linux are highly optimized. I suspect using std::vector<FlWidget*> everywhere possible would not cause any problems or incompatibility, the old widgets did hide the implementation pretty well.

On Thu, Jul 15, 2021 at 5:32 AM Albrecht Schlosser <AlbrechtS.fltk@online.de> wrote:
Isn't it time to think about using simple std::container types in FLTK?

I've seen the necessity of using vectors in some situations (patches),
particularly useful would be

- std::vector<int>
- std::vector<Fl_Widget *>

I'm not asking to rewrite existing code, just to add such containers
where useful. The potential new widget Fl_Flex
(https://github.com/osen/FL_Flex) would be an example but I know of at
least one patch that suggested using a vector.

I don't know about real compatibility issues with old (maybe embedded)
systems and such. Do we still need to take care or can we "move our code
base a little forward" WRT more modern C++ standards? According to
https://www.cplusplus.com/reference/vector/vector/ class vector is
defined in C++98 with some additions in C++11.

If not (and I think one valid reason is enough, like a veto), then I
suggest to add some similar classes for internal usage rather than
inventing the wheel over and over again. I could search and give some
examples but I don't want to do this now.

All comments would be appreciated, not only from FLTK devs. Thanks.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/6a1d9208-9cf0-28b6-bdf1-853ae2db9345%40online.de.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/CAL-8oAiYfvPr7z%3Dt%3DkU4nuSH%3DZLgd4d7QJg7CqGihN0058-%2B5w%40mail.gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.