Re: Cross platform C++ base library?



Thanks G. At this point I think just using the base classes from a cross platform framework like Qt (QtCore) or wxWidgets (wxBase) is my best bet.

Cheers,
David


"Giovanni Dicanio" <giovanniDOTdicanio@xxxxxxxxxxxxxxxxx> wrote in message news:u4N3j6QYJHA.4272@xxxxxxxxxxxxxxxxxxxxxxx
Hi David,

as a result of a web search, I found a class similar to CString, but whose implementation is done using STL. This way, you should have both the cross-platform feature (because the class is built on top of STL), and the CString-like public interface:

CString-like Class Using STL
http://www.developer.com/net/cplus/article.php/627611

(I seem to recall that in the past I read something similar of that on CodeProject, but I'm not sure...)

Unfortunately, I'm not aware of "simplified" versions of std::vector, std::map and tr1::shared_ptr.

My first reaction to STL was that of a disagreement (starting from the naming convention; in fact, I prefer camelCasing or PascalCasing to c_linux_hacker_casing :)

Moreover, I really don't like std::map having 'first' and 'second'; I would much more prefer 'Key' and 'Value' (like in C# BCL Dictionary container) as naming choice!

However, I learnt the basics of STL containers like vector and map, and now I'm glad to use these STL containers (excluding the naming conventions).
For example, I like the non-linear factor (1.5X) policy of vector capacity growing (instead I think that MFC's CArray implements the poor arithmetic growing factor).

But I'm not an STL guru, e.g. I've not learnt to use STL allocators, yet.

However, I believe that you are a bright programmer and you can master STL as well! :)

If you really don't like STL, you could just use STL as the core to implement classes with an MFC-like interface (e.g. a David::CArray, David::CList, etc. based on std::vector, std::list, etc.). So, you can continue using the MFC-like interfaces, and you also have cross-platform thanks to STL implementation "under the hood".
(In this case, you just need to program the STL containers only once, when you write the *implementation* of your custom classes like David::CArray, then you forget about STL, and you use the usual MFC-like public interfaces of your custom classes.)

My 2 cents,
Giovanni

.



Relevant Pages

  • Re: Cross platform C++ base library?
    ... It doesn't need to support GUI. ... I realize the default choice is STL, ... This way, you should have both the cross-platform feature, and the CString-like public interface: ... However, I learnt the basics of STL containers like vector and map, and now I'm glad to use these STL containers. ...
    (microsoft.public.vc.mfc)
  • Re: Clean code vs. efficiency
    ... > instead of character arrays. ... The default STL ... In general, the STL containers are extremely fast, and might be faster than ... The STL allocators let you use pool allocators, but you can also that by ...
    (comp.lang.cpp)
  • Re: A solution to warning C4251 - class needs to have dll-interface...?
    ... Because the functions of the STL containers ... are completely defined by their header files. ... the static data for the entire program. ...
    (microsoft.public.vc.language)
  • Re: multiset segfault
    ... > page and on Google for my STL information. ... some sections on STL containers, and it is anyway worth reading the ... if you google for "STL tutorial" you'll find many more ...
    (comp.lang.cpp)
  • Re: Clean code vs. efficiency
    ... > In general, the STL containers are extremely fast, and might be faster than ... this year given by a guy from the Xbox ATG. ... This speaker mentioned that in *every single case*, the STL (shipping ... much cleaner than those I wrote prior to that. ...
    (comp.lang.cpp)