#52 fixed_array and 64bit linux/gcc-4.5

1.9
open
nobody
None
5
2011-09-29
2011-09-29
No

Hi all,

I'm porting some software to 64bit linux from 32bit windows. Some of our code uses stlsoft::fixed_array_2d, but compilation fails.

I have made this simple test-case to show the problem:

#include <stlsoft/containers/fixed_array.hpp>

int main()
{
typedef stlsoft::fixed_array_2d<double> FixedArray;
typedef FixedArray::dimension_element_type Array1d;

FixedArray array(42,42);
const Array1d dim = array.at_unchecked(2);
}

And get a following compile error.

Looking at the code:

#ifdef STLSOFT_MULTIDIM_ARRAY_FEATURE_REQUIRES_COPY_CTOR_WITH_RVO

template <ss_typename_param_k T, ss_typename_param_k A, ss_typename_param_k P, ss_bool_t R>
inline fixed_array_1d<T, A, P, R>::fixed_array_1d(fixed_array_1d<T, A, P, R> const& rhs)
: m_data(R ? allocate_(rhs.dimension0()) : rhs.m_data)
, m_d0(rhs.dimension0())
{
if(R)
{
array_range_initialiser<T, A, P>::copy_construct(*this, data_(), rhs.data(), size());
}
}

#else /* ? STLSOFT_MULTIDIM_ARRAY_FEATURE_REQUIRES_COPY_CTOR_WITH_RVO */

template <ss_typename_param_k T, ss_typename_param_k A, ss_typename_param_k P, ss_bool_t R>
inline fixed_array_1d<T, A, P, R>::fixed_array_1d(fixed_array_1d<T, A, P, R> const& rhs)
: m_data(allocate_(rhs.dimension0()))
, m_d0(rhs.dimension0())
{
STLSOFT_STATIC_ASSERT(R);
array_range_initialiser<T, A, P>::copy_construct(*this, data_(), rhs.data(), size());
}

#endif /* STLSOFT_MULTIDIM_ARRAY_FEATURE_REQUIRES_COPY_CTOR_WITH_RVO */

Then why does one implementation use

if(R) { ... }

and the other not?

kind regards

-Thorsten

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks