|
I can't believe I haven't read this before.
Thanks for the link.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
You mean you don't have "Effective STL"? Shame!
|
|
|
|
|
I took the plunge. One word - 'Wow!'. What a fantastic library!
Can anyone give me some quick Boost recommendations? So far I have used list_of(), indirect_iterator, tokenizer, trim and, of course, shared_ptr. What are your favourite Boost libs?
The Rob Blog
|
|
|
|
|
Robert Edward Caldecott wrote:
'Wow!'. What a fantastic library!
Agree 100%.
Robert Edward Caldecott wrote:
Can anyone give me some quick Boost recommendations?
It really depends on the nature of your projects. I am currently involved with text processing libraries, and thus mostly use regex, lexical_cast and tokanizer, and looking forward to using string_algo.
Also, I make a heavy use of smart pointers, tuple and test, and to a lesser extent filesystem, bind and graph.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I'm also a Boost addict...
You should definitely take a look at boost::bind and boost::signal, I use them all the time. I recently started using boost::serialization and boost::regex. Both are simple to use and extremely powerful.
|
|
|
|
|
Practically: regex, bind (oh, yeah!), shared_ptr, string_algo, signals, function, tuple, variant, optional
From a 'wow' point of view: lambda, spirit.
I've also started using Boost.Test for unit testing -
Just one thing - if you're not using VC7.1, try and do so - you'll be doing yourself a favour...
|
|
|
|
|
Yeh, bind. Very useful. I have been using containers of shared_ptr's, and it is so cool that I can do something like:
class CFoo
{
...
void fn(int n, std::string str)
{
}
};
...
std::vector<boost::shared_ptr<CFoo> > v;
v.push_back(boost::shared_ptr<CFoo>(new CFoo));
...
for_each(v.begin(), v.end(), boost::bind(&CFoo::fn, _1, 1234, "Boost!"));
Splendid. Using boost::bind for std::find_if is also very useful. So much to learn...
|
|
|
|
|
Robert Edward Caldecott wrote:
std::vector<boost::shared_ptr<CFoo> > v;
v.push_back(boost::shared_ptr<CFoo>(new CFoo));...
for_each(v.begin(), v.end(), boost::bind(&CFoo::fn, _1, 1234, "Boost!"));
And you call that cool?? I mean, seriously?
Well, there's no accounting for taste.
|
|
|
|
|
You don't think smart pointers are useful? You don't think for_each is useful? Aaahh ... I see from previous posts that you actually think STL is "bloatware". What a shame. Other than the fact that both STL and Boost are incredibly powerful, I need to write code for Windows AND Linux, and without these libraries, this would be difficuly to achieve.
|
|
|
|
|
Robert Edward Caldecott wrote:
You don't think smart pointers are useful?
I think, somebody who puts pointers or smart pointers into a std container has not understood one basic principle of STL, that is, 'value semantics'.
What a shame. Other than the fact that both STL and Boost are incredibly powerful, I need to write code for Windows AND Linux, and without these libraries, this would be difficuly to achieve.
It's ok if it works for you. IMO, it's not really elegant that one has to write
v.push_back(boost::shared_ptr<CFoo>(new CFoo));
to insert an element.
|
|
|
|
|
CP Visitor wrote:
It's ok if it works for you. IMO, it's not really elegant that one has to write
Why not? You could always use typedef:
typedef boost::shared_ptr<CFoo> foo_sp;
...
v.push_back(foo_sp(new CFoo));
Elegant enough IMO, though people seem to either love or hate typedef. Using smart pointers in containers is very useful, and from experience, it has meant more time concentrating on the job at hand instead of tracking down memory leaks. I did use the ATL7 CAutoPtr class (and associated CAtlArray/CAtlList) but that's no help for writing portable code plus I prefer using STL iterators over MFC's 'POSITION' scheme. Shrug.
Whatever works I guess. But the more I use STL/Boost, the more I wonder why I went so long without it!
|
|
|
|
|
Boost.MPL[^] is an impressive achievement and a mind-opener for those venturing into the world of C++ metaprogramming. I wonder, however, how much real use metaprogramming gets in the C++ community.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
|
Is Boost a full STL implementation? If so, won't some of the classes clash with VC++'s STL classes? Or are the Boost classes in a different namespace?
|
|
|
|
|
Nishant Sivakumar wrote:
Is Boost a full STL implementation?
No - it's not an STL implementation at all...apart from some of the things that are added at TR1 (like regex, smart pointers, function and some other stuff) and are so are not yet in any STL that you'll have access to). Really, if you consider Boost as a sandpit for libraries that are or could be potential additions to the Standard C++ library, you're not far wrong.
Also - Boost classes are all in the boost namespace or a child namespace of boost.
|
|
|
|
|
|
Hello all.
I'm writing WMI Instance/Method provider. Working in VS.NET 2003. ClassWiz generates some code for WMI Instance Provider, using IWbemInstProviderImpl class. I haven't managed to find any documentation about the wizard usage or about the class and classes discribed in the same header file.
Please, let me know, if someone knows where I can get some information about the stuff.
Thanks in advance.
Just a student!
|
|
|
|
|
I am currently working on handling ATL COM events in WIN32 exe (on winCE platform using eVC++). I am able to raise an event in COM component but not able to handle it in WIN32 exe.
I have tried different ways to implement this functionality but the results are same. If I port the code in VC++ it works fine.
My work has halted due to this problem. Please let me know the solution to this problem.
Thanks in advance.
|
|
|
|
|
Hello, All!
I need to place a background image to my CListViewCtrl. How to do it??? I used WM_ERASEBKGND handler, but list-view' items cover my image...
(Report, List view)
|
|
|
|
|
|
I am trying to host an ActiveX control in a WTL Dialog app, very similar to what the example in the article "WTL for MFC Programmers, Part VI". I think the example given by Michael Dunn will be a great help to me, except that it does not complile in Visual Studio .NET 2003. There must have been changes to ATL or WTL that make the code not compile? Can anyone help me get it to build?
|
|
|
|
|
Here are the errors I am getting when I try to build:
Compiling...
maindlg.cpp
d:\samples\WTL4MFC6_demo\IEHost\maindlg.h(112) : error C2955: 'ATL::IDispEventSimpleImpl' : use of class template requires template argument list
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlcom.h(4122) : see declaration of 'ATL::IDispEventSimpleImpl'
d:\samples\WTL4MFC6_demo\IEHost\maindlg.h(112) : error C2440: 'static_cast' : cannot convert from 'CMainDlg::_ComMapClass *' to 'ATL::IDispEventSimpleImpl *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\samples\WTL4MFC6_demo\IEHost\maindlg.h(112) : error C2440: 'initializing' : cannot convert from 'ATL::_ATL_CREATORARGFUNC (__stdcall *)' to 'DWORD_PTR'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
IEHost.cpp
d:\samples\WTL4MFC6_demo\IEHost\maindlg.h(112) : error C2955: 'ATL::IDispEventSimpleImpl' : use of class template requires template argument list
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlcom.h(4122) : see declaration of 'ATL::IDispEventSimpleImpl'
d:\samples\WTL4MFC6_demo\IEHost\maindlg.h(112) : error C2440: 'static_cast' : cannot convert from 'CMainDlg::_ComMapClass *' to 'ATL::IDispEventSimpleImpl *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\samples\WTL4MFC6_demo\IEHost\maindlg.h(112) : error C2440: 'initializing' : cannot convert from 'ATL::_ATL_CREATORARGFUNC (__stdcall *)' to 'DWORD_PTR'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Generating Code...
IEHost - 6 error(s), 0 warning(s)
|
|
|
|
|
Yeah, I did things the hard way in that example - there's no need to manually build the SINK_MAP macros since ClassWizard (in VC6 at least) can do it for you. I haven't looked at VC7 enough to know where the equivalent feature is but I would assume it's still in there.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
hello,
i've created a std::list of objects, and it works well, but i'd like to support additional functionality for the list, such as writing certain aspects of the objects to stdout/cout (or dumping them using TRACE macros), matching certain aspects of objects (i.e., several different "match" functions), populating a list box with objects' names, etc. i've tried 2 approaches:
1. wrap the std::list in a class that handles these functions by using the list's iterators. this is inelegant, so i switched to:
2. subclass my std::list<myobject>, and add the functions i need to the new class. from what i've read on the web, subclassing std::list isn't a good idea, due to the virtual destructor problem.
my guess is that i should be using functions that operate on this list, but creating functions instead of list methods seems to violate the whole point of using c++. i'd appreciate any advice, since this is my first project using the stl, and i'm still waiting for my stl book to arrive in the mail....
ed
|
|
|
|
|
If you don't add any new data in your derived class, you should be OK in most cases (because your derived destructor won't actually need to do anything more than the std::lsit destructor).
OTOH - ehh wrote: violate the whole point of using c++ - well, C++ is a multi-paradigm language, so using separate free functions doesn't really violate any point of C++....
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|