Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Qt work well with STL & Boost?

Tags:

c++

stl

boost

qt

I am interested in learning Qt. I am fairly good with C++, STL and Boost. I like STL/Boost style very much, and I use them with C++ whenever I can in uni projects. However, I always miss the GUI. It seems that Qt is the best solution in my case. Qt does have a good collection of containers, but I am greatly familiar with STL/Boost stuff.

What should I take care of when learning Qt and using it side by side with STL/Boost?

like image 982
Khaled Alshaya Avatar asked Aug 09 '09 03:08

Khaled Alshaya


1 Answers

Yes, Qt works just fine with both Boost and the STL. Most of the STL functionality is duplicated in Qt to ensure that such features are supported on all of the platforms that support Qt. However, nothing prohibits you from using STL/boost counterparts of the Qt constructs or functionality therein that Qt lacks.

Although Qt has its own string, container and algorithm objects, it also contains a great deal of functions for compatability with STL. For example, a QString can be converted to a std::string and a QVector can be used with std::for_each. Qt also contains some features that overlap with boost such as QPointer (compare/contrast with std:auto_ptr and boost:shared_ptr).

The Creating Custom Qt Types article may provide some insight into using advanced features with boost objects such as transmitting custom objects between threads with queued connections.

See also:

  • Mixing Qt and Boost
  • Mixing Qt with STL and Boost - are there any bridges to make it easy?
like image 108
Judge Maygarden Avatar answered Sep 19 '22 21:09

Judge Maygarden