X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4f4afa70b8cc31bd39d3ab5dbaf7ae899c77b34b..da06ff05b3164a8de84cfcfc427384c7791e5647:/include/xbt/string.hpp diff --git a/include/xbt/string.hpp b/include/xbt/string.hpp index 7af6d332c1..5b8ab7d46d 100644 --- a/include/xbt/string.hpp +++ b/include/xbt/string.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2015-2019. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -6,7 +6,7 @@ #ifndef SIMGRID_XBT_STRING_HPP #define SIMGRID_XBT_STRING_HPP -#include +#include #include #include @@ -121,7 +121,8 @@ public: } string& operator=(string const& s) { - assign(s.c_str(), s.size()); + if (this != &s) + assign(s.c_str(), s.size()); return *this; } string& operator=(std::string const& s) @@ -136,7 +137,7 @@ public: bool empty() const { return len != 0; } void shrink_to_fit() { /* Being there, but doing nothing */} - // Alement access + // Element access char* data() { return string_data::data; } const char* data() const { return string_data::data; } char* c_str() { return string_data::data; }