c++.stlsoft - fixed_array problems on 64 bit linux
- Thorsten Ottosen (32/32) Sep 26 2011 Hi all,
- Thorsten Ottosen (34/38) Sep 26 2011 [Snip]
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 the following compile error: gcc.compile.c++ bin/gcc-4.5.2/debug/debug-symbols-off/threading-multi/test.o In file included from test.cpp:1:0: /home/thorsten/cpp_projects/CDependencies/include/stlsoft/contain rs/fixed_array.hpp: In copy constructor ‘stlsoft::fixed_array_1d<T, A, P, R>::fixed_array_1d(const stlsoft::fixed_array_1d<T, A, P, R>&) [with T = double, A = std::allocator<double>, P = stlsoft::do_construction<double>, bool R = false]’: test.cpp:9:44: instantiated from here /home/thorsten/cpp_projects/CDependencies/include/stlsoft/containers/fi ed_array.hpp:967:5: error: creating array with negative size (‘-0x00000000000000001’) "g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -pthread -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_DYN_LINK=1 -DDEZIDE_USE_DYNAMIC_LINKING=1 -I"." -I"/home/thorsten/cpp_projects/CDependencies/include" -c -o "bin/gcc-4.5.2/debug/debug-symbols-off/threading-multi/test.o" "test.cpp" I'm having no problem using the views on windows/visual C++. Can anybody see a fix? kind regards -Thorsten
Sep 26 2011
Den 26-09-2011 17:55, Thorsten Ottosen skrev: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:[Snip] 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? -Thorsten
Sep 26 2011