summaryrefslogtreecommitdiff
path: root/boost/mpi/detail/antiques.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/mpi/detail/antiques.hpp')
-rw-r--r--boost/mpi/detail/antiques.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/boost/mpi/detail/antiques.hpp b/boost/mpi/detail/antiques.hpp
index 0bd235b2c1..a84760f8f1 100644
--- a/boost/mpi/detail/antiques.hpp
+++ b/boost/mpi/detail/antiques.hpp
@@ -19,10 +19,10 @@ namespace detail {
// serve as an incentive to get rid of this when those compilers
// are dropped.
template <typename T, typename A>
- T* c_data(std::vector<T,A>& v) { return &(v[0]); }
+ T* c_data(std::vector<T,A>& v) { return v.empty() ? static_cast<T*>(0) : &(v[0]); }
template <typename T, typename A>
- T const* c_data(std::vector<T,A> const& v) { return &(v[0]); }
+ T const* c_data(std::vector<T,A> const& v) { return v.empty() ? static_cast<T const*>(0) : &(v[0]); }
// Some old MPI implementation (OpenMPI 1.6 for example) have non
// conforming API w.r.t. constness.