Now that I have a better grasp of the scope and capabilities of the C++Standard Library, I understand that products such as Qt actually providemuch of the same functionality through their own libraries. I''m not sureif that''s a good thing or not. AFAIK, most of Qt is compatable with theStandard Library. That is, QLT can interoperate with STL, and you canconvert back and forth between std::string and Qt::QString, etc.Are there any other libraries based on Standard C++, but not on the C++Standard Library? What might these be? Why do people create these? Areany significantly different from the C++ Standard Library? Is it good thatpeople create their own basic libraries instead of using the StandardLibrary?--If our hypothesis is about anything and not about some one or moreparticular things, then our deductions constitute mathematics. Thusmathematics may be defined as the subject in which we never know what weare talking about, nor whether what we are saying is true.-Bertrand Russell 解决方案 On 2005-06-30, Steven T. Hatton <ch********@germania.sup> wrote: Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own libraries. I''m not sure if that''s a good thing or not.For the most part, it''s not a very good thing, and if one were building thesetoolkits from scratch today, they would be done differently (one would hope...)Many of these toolkits predate the C++ ''98 standard. So they builtsimilar infrastructure (actually, usually worse. Most pre-STL containertoolkits look pretty amateurish compared to STL)One of the benefits of using a mature language is that there are all of thesetoolkits to work with. But part of the price you pay is that there is a lotof baggage as well -- you get things that are written to old standards, andthen have to be bent and twisted to work with new standards. There areexamples of this in the C++ language itself. AFAIK, most of Qt is compatable with the Standard Library. That is, QLT can interoperate with STL, and you can convert back and forth between std::string and Qt::QString, etc. Are there any other libraries based on Standard C++,Qt is not really based on standard C++, since it predates that (the Qtproject started around 1996 or so)So you could go and implement your new and improved toolkit that''s integratedwith STL, or settle for the mature one that is awkward to use with STL. Oryou could look for a toolkit written by someone else post-standard that ismore STL friendly (but probably less mature than the pre-standard kits).Choose your poison.Cheers,--Donovan Rebbechi http://pegasus.rutgers.edu/~elflord/"Steven T. Hatton" <ch********@germania.sup> wrote in messagenews:ev********************@speakeasy.net Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own libraries. I''m not sure if that''s a good thing or not. AFAIK, most of Qt is compatable with the Standard Library. That is, QLT can interoperate with STL, and you can convert back and forth between std::string and Qt::QString, etc. Are there any other libraries based on Standard C++, but not on the C++ Standard Library? What might these be? Why do people create these? Are any significantly different from the C++ Standard Library? Is it good that people create their own basic libraries instead of using the Standard Library?I think you will find that most of the libraries pre-date the standardlibrary (i.e., they date from pre-1998). MFC, which, like QT, pre-datesstandard C++ by many years, has its own string, array, list and map classes,as does ATL (Active Template Library).These classes linger on because of backward compatibility, becauseprogrammers are familiar with them and don''t want to change, and (sometimes)because they embody different design decisions that are genuinely preferablefor some purposes.--John Carson Donovan Rebbechi wrote: On 2005-06-30, Steven T. Hatton <ch********@germania.sup> wrote: Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own libraries. I''m not sure if that''s a good thing or not. For the most part, it''s not a very good thing, and if one were building these toolkits from scratch today, they would be done differently (one would hope...)I''ve been using Qt based products since 1997 when the KDE was still inalpha. I don''t believe Trolltech have significant misgivings about thecore design of their libraries, and since they reinvent the blinkin'' thingabout once every two years, whatever they would have done differently, hasbeen done differently. Many of these toolkits predate the C++ ''98 standard. So they built similar infrastructure (actually, usually worse. Most pre-STL container toolkits look pretty amateurish compared to STL)I don''t belive the QTL will fit that category. The functionality offered intheir API is arguably superior to that of the Standard, and the Standarddoesn''t specify implementation. One of the benefits of using a mature language is that there are all of these toolkits to work with. But part of the price you pay is that there is a lot of baggage as well -- you get things that are written to old standards, and then have to be bent and twisted to work with new standards. There are examples of this in the C++ language itself.I''ve seen this happen with Java and Qt. The first release was dramaticallyaltered in the next major version. This broke a lot of the originalsoftware. Fortunately for the Qt and Java developers, that break with thepast was worth the improved functionality. As Java and Qt became moreestablished, there was more concern with backward compatability. I have togive Trolltech credit for their audacity in rolling out a major redesign inQt4 while including a full backward compatability subset. AFAIK, most of Qt is compatable with the Standard Library. That is, QLT can interoperate with STL, and you can convert back and forth between std::string and Qt::QString, etc. Are there any other libraries based on Standard C++, Qt is not really based on standard C++, since it predates that (the Qt project started around 1996 or so)I disagree. There really is nothing in Qt that is not implemented usingStandard C++. Basically what they do is provide some language extensionswhich are processed by the MOC to produce pure, Standard C++. I don''t likethe amount of #MACRO magic they use, but the only times I''ve really hadproblems with it are when I have collisions with Boost #MACRO magic. Sinceboost is pretty much the playground of the Standard Committee, it''s hard tobe too critical of Trolltech in that situation. So you could go and implement your new and improved toolkit that''s integrated with STL, or settle for the mature one that is awkward to use with STL. Or you could look for a toolkit written by someone else post-standard that is more STL friendly (but probably less mature than the pre-standard kits). Choose your poison.Actually, the QTL containers are, AFAIK, fully compatable with STLalgorithms, and there is no reason that I can think of for not being ableto construct STL from QTL containers and vis-verse. The QTL containersoffer additional features such as implicit sharing, and "Java-style"iterators. Hopefully, C++0X will adopt the new for() semantics supportingforEach functionality. That will make Qt''s current foreach #MACROredundant. For now, Qt offers that additional, and superior functionality.As for QString verses std::string, the advantage std::string has is thatit''s standard. Beyond that, I don''t believe it even comes close toQString, and that doesn''t even address QStringList.The downside I see with using QTL is that it is bound to Qt. As you mighthave gathered, I''m a big fan of Qt. Nonetheless, I want my code to standon its own in areas where it should be toolkit agnostic.--If our hypothesis is about anything and not about some one or moreparticular things, then our deductions constitute mathematics. Thusmathematics may be defined as the subject in which we never know what weare talking about, nor whether what we are saying is true.-Bertrand Russell 这篇关于C ++标准库的替代品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-29 22:41
查看更多