X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3def2297f6cb436bc6cc26e04a3ac453fdaf3b9e..cb746c8d5f7015456bbfd78b4ae303142599aabe:/src/mc/remote/RemotePtr.hpp diff --git a/src/mc/remote/RemotePtr.hpp b/src/mc/remote/RemotePtr.hpp index 88effca9f9..d92eb7a2a5 100644 --- a/src/mc/remote/RemotePtr.hpp +++ b/src/mc/remote/RemotePtr.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2015. The SimGrid Team. +/* Copyright (c) 2008-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -38,13 +38,16 @@ private: T buffer; public: - Remote() {} - ~Remote() {} - Remote(T& p) { std::memcpy(&buffer, &p, sizeof(buffer)); } - Remote(Remote const& that) { std::memcpy(&buffer, &that.buffer, sizeof(buffer)); } + Remote() { /* Nothing to do */} + ~Remote() { /* Nothing to do */} + Remote(T const& p) { std::memcpy(static_cast(&buffer), static_cast(&p), sizeof(buffer)); } + Remote(Remote const& that) + { + std::memcpy(static_cast(&buffer), static_cast(&that.buffer), sizeof(buffer)); + } Remote& operator=(Remote const& that) { - std::memcpy(&buffer, &that.buffer, sizeof(buffer)); + std::memcpy(static_cast(&buffer), static_cast(&that.buffer), sizeof(buffer)); return *this; } T* getBuffer() { return &buffer; } @@ -89,7 +92,7 @@ public: T* local() const { return (T*)address_; } operator bool() const { return address_; } - bool operator!() const { return !address_; } + bool operator!() const { return not address_; } operator RemotePtr() const { return RemotePtr(address_); } RemotePtr operator+(std::uint64_t n) const { return RemotePtr(address_ + n * sizeof(T)); } RemotePtr operator-(std::uint64_t n) const { return RemotePtr(address_ - n * sizeof(T)); }