Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:57

0001 //          Copyright Alain Miniussi 2014.
0002 // Distributed under the Boost Software License, Version 1.0.
0003 //    (See accompanying file LICENSE_1_0.txt or copy at
0004 //          http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 // Authors: Alain Miniussi
0007 
0008 #ifndef BOOST_MPI_ANTIQUES_HPP
0009 #define BOOST_MPI_ANTIQUES_HPP
0010 
0011 #include <vector>
0012 
0013 // Support for some obsolette compilers
0014 
0015 namespace boost { namespace mpi {
0016 namespace detail {
0017   // Some old gnu compiler have no support for vector<>::data
0018   // Use this in the mean time, the cumbersome syntax should 
0019   // serve as an incentive to get rid of this when those compilers 
0020   // are dropped.
0021   template <typename T, typename A>
0022   T* c_data(std::vector<T,A>& v) { return v.empty() ? static_cast<T*>(0) : &(v[0]); }
0023 
0024   template <typename T, typename A>
0025   T const* c_data(std::vector<T,A> const& v) { return v.empty() ? static_cast<T const*>(0) : &(v[0]); }
0026 
0027   // Some old MPI implementation (OpenMPI 1.6 for example) have non 
0028   // conforming API w.r.t. constness.
0029   // We choose to fix this trhough this converter in order to 
0030   // explain/remember why we're doing this and remove it easilly 
0031   // when support for those MPI is dropped.
0032   // The fix is as specific (un templatized, for one) as possible 
0033   // in order to encourage it usage for the probleme at hand.
0034   // Problematic API include MPI_Send
0035   inline
0036   void *unconst(void const* addr) { return const_cast<void*>(addr); }
0037 
0038 } } }
0039 
0040 #endif