Board index » cppbuilder » include Boost

include Boost


2006-05-09 07:07:37 AM
cppbuilder68
My program ends up with a linear arrangement of objects.
Each object is made from the same class with its own multi-dimensional
array as part of its data, and some functions to process it.
I was using pointers to the class with new and delete, with very
limited success. Probably delete & destructors were the limiting
factors.
To avoid delete & destructors, I will try boost.
Can <vector>deal with this linear arrangement?
Should I #include:
"boost/shared_ptr.hpp", "boost/smart_ptr.hpp", "boost/shared_array.hpp"
or all of them?
 
 

Re:include Boost

"joel javish" < XXXX@XXXXX.COM >wrote in message
Quote
My program ends up with a linear arrangement of objects.

Each object is made from the same class with its own multi-dimensional
array as part of its data, and some functions to process it.

I was using pointers to the class with new and delete, with very
limited success. Probably delete & destructors were the limiting
factors.

To avoid delete & destructors, I will try boost.

Can <vector>deal with this linear arrangement?

Should I #include:
"boost/shared_ptr.hpp", "boost/smart_ptr.hpp", "boost/shared_array.hpp"
or all of them?
std::vector requires that objects are copyable. Check the boost docs to see
which
works best. They have fairly extensive documentation.
We mostly use shared_ptr where we can't use static
objects and it works well. Certainly less problematic than raw pointers.
I'm not very familiar with the others you mention.
 

Re:include Boost

"Duane Hebert" < XXXX@XXXXX.COM >wrote in message
Quote

"joel javish" < XXXX@XXXXX.COM >wrote in message
news:445fcf33$ XXXX@XXXXX.COM ...
std::vector requires that objects are copyable. Check the boost docs to
see
Meant to say that I think all of these meet std::vector's
requirements.
 

{smallsort}

Re:include Boost

Thanks for your input Duane.
Below shows what happened after I downloaded from Boost into c++b6, and
tried to run examples.
Is there some preprocessing I should be doing?
// Boost
hared_ptr_example.cpp --------------------------------------------//
#include <boost/shared_ptr.hpp>
[C++ Error] shared_ptr_example.cpp(22): E2209 Unable to open include file
'boost\shared_ptr.hpp'
[C++ Error] shared_ptr_example.cpp(37): E2090 Qualifier 'boost' is not a
class or namespace name
//----------------------------------------------------------------
* $Id: random_demo.cpp,v 1.17 2005/05/10 20:40:59 jmaurer Exp $
*
* A short demo program how to use the random number library.
*/
#include <boost/random/linear_congruential.hpp>
#include <boost/random/uniform_int.hpp>
[C++ Error] random_demo.cpp(17): E2209 Unable to open include file
'boost\random\linear_congruential.hpp'
[C++ Error] random_demo.cpp(18): E2209 Unable to open include file
'boost\random\uniform_int.hpp'
 

Re:include Boost

"joel javish" < XXXX@XXXXX.COM >wrote in message
Quote
Thanks for your input Duane.

Below shows what happened after I downloaded from Boost into c++b6, and
tried to run examples.
Is there some preprocessing I should be doing?

// Boost
ared_ptr_example.cpp --------------------------------------------//


#include <boost/shared_ptr.hpp>

[C++ Error] shared_ptr_example.cpp(22): E2209 Unable to open include file
'boost\shared_ptr.hpp'
[C++ Error] shared_ptr_example.cpp(37): E2090 Qualifier 'boost' is not a
class or namespace name

Some of the boost stuff needs to use the libs but the ones
that you show here should work out of the box. It looks
like you don't have boost in your path. You need to
add that to your include path in BCB.