Boost logo

Ublas :

From: Darin DeForest (darin_at_[hidden])
Date: 2005-08-26 11:56:35


I defined BOOST_UBLAS_SHALLOW_ARRAY_ADAPTOR in boost\numeric\ublas\detail\config.hpp file

which seems appropriate since there are several define statements to alter ublas, and there is section called:

/*
 * General Configuration
 */

The only alternate location seems to define it as a compiler option.

So I defined in the config.hpp

#define BOOST_UBLAS_SHALLOW_ARRAY_ADAPTOR 1

and then tried to compile. I got a syntax error on

        shared_array<value_type> data_;

in the shallow array adapter class.

This seemed odd because

#ifdef BOOST_UBLAS_SHALLOW_ARRAY_ADAPTOR
#include <boost/shared_array.hpp>
#endif

was defined at the top.

Then I realized that this was defined before the config.hpp was read.
So by switching the order to

#include <boost/numeric/ublas/exception.hpp>
#include <boost/numeric/ublas/detail/iterator.hpp>

#ifdef BOOST_UBLAS_SHALLOW_ARRAY_ADAPTOR
#include <boost/shared_array.hpp>
#endif

this ensures that the config.hpp is read first, and now the code compiles fine.

Is this the proper way to handle this? And if so can it be incorporated into the code?