1 // Copyright Alain Miniussi 2014.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 // Authors: Alain Miniussi
8 #ifndef BOOST_MPI_ANTIQUES_HPP
9 #define BOOST_MPI_ANTIQUES_HPP
13 // Support for some obsolette compilers
15 namespace boost { namespace mpi {
17 // Some old gnu compiler have no support for vector<>::data
18 // Use this in the mean time, the cumbersome syntax should
19 // serve as an incentive to get rid of this when those compilers
21 template <typename T, typename A>
22 T* c_data(std::vector<T,A>& v) { return v.empty() ? static_cast<T*>(0) : &(v[0]); }
24 template <typename T, typename A>
25 T const* c_data(std::vector<T,A> const& v) { return v.empty() ? static_cast<T const*>(0) : &(v[0]); }
27 // Some old MPI implementation (OpenMPI 1.6 for example) have non
28 // conforming API w.r.t. constness.
29 // We choose to fix this trhough this converter in order to
30 // explain/remember why we're doing this and remove it easilly
31 // when support for those MPI is dropped.
32 // The fix is as specific (un templatized, for one) as possible
33 // in order to encourage it usage for the probleme at hand.
34 // Problematic API include MPI_Send
36 void *unconst(void const* addr) { return const_cast<void*>(addr); }