From 600ece657cffbe66e2d292ad9ab58c85a1201185 Mon Sep 17 00:00:00 2001 From: Joss Whittle Date: Fri, 28 Oct 2016 00:31:05 +0100 Subject: [PATCH] bug fix --- MEL_deepcopy.hpp | 63 +++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/MEL_deepcopy.hpp b/MEL_deepcopy.hpp index 4f5e856..0414f43 100644 --- a/MEL_deepcopy.hpp +++ b/MEL_deepcopy.hpp @@ -294,10 +294,13 @@ namespace MEL { template using enable_if_not_deep_not_pointer = typename std::enable_if::Has && !std::is_pointer::value, R>::type; - template - using is_vector = typename std::is_same>; - template - using is_list = typename std::is_same>; + template struct is_vector : public std::false_type {}; + template + struct is_vector> : public std::true_type{}; + + template struct is_list : public std::false_type {}; + template + struct is_list> : public std::true_type{}; //template //using is_string = typename std::is_same; @@ -531,20 +534,20 @@ namespace MEL { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // STL - inline void packSTL(std::string &obj) { - int len; - if (TRANSPORT_METHOD::SOURCE) { - len = obj.size(); - transport(len); - } - else { - transport(len); - new (&obj) std::string(len, ' '); - } - - char *p = &obj[0]; - if (len > 0) transport(p, len); - }; + inline void packSTL(std::string &obj) { + int len; + if (TRANSPORT_METHOD::SOURCE) { + len = obj.size(); + transport(len); + } + else { + transport(len); + new (&obj) std::string(len, ' '); + } + + char *p = &obj[0]; + if (len > 0) transport(p, len); + }; template inline enable_if_not_deep packSTL(std::vector &obj) { @@ -762,16 +765,16 @@ namespace MEL { return *this; }; - template + template inline Message& operator&(T &obj) { packVar(obj); return *this; }; - inline Message& operator&(std::string &obj) { - packSTL(obj); - return *this; - }; + inline Message& operator&(std::string &obj) { + packSTL(obj); + return *this; + }; }; #define TEMPLATE_STL template @@ -926,14 +929,14 @@ namespace MEL { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Pointer - TEMPLATE_P + TEMPLATE_P inline enable_if_pointer

Send(const P &ptr, const int dst, const int tag, const Comm &comm) { - Send((P) ptr, dst, tag, comm); + Send((P) ptr, dst, tag, comm); }; TEMPLATE_P inline enable_if_pointer

Send(P &ptr, const int dst, const int tag, const Comm &comm) { - Message msg(dst, tag, comm); + Message msg(dst, tag, comm); msg.packRootPtr(ptr); }; @@ -2275,10 +2278,10 @@ namespace MEL { MEL::Deep::BufferedFileWrite(ptr, file, MEL::Deep::BufferSize(ptr)); }; - TEMPLATE_P - inline enable_if_pointer

BufferedFileWrite_FUCK(P &ptr, std::ofstream &file) { - MEL::Deep::BufferedFileWrite(ptr, file, MEL::Deep::BufferSize(ptr)); - }; + TEMPLATE_P + inline enable_if_pointer

BufferedFileWrite_FUCK(P &ptr, std::ofstream &file) { + MEL::Deep::BufferedFileWrite(ptr, file, MEL::Deep::BufferSize(ptr)); + }; TEMPLATE_P_F(TransportBufferWrite) inline enable_if_pointer

BufferedFileWrite(P &ptr, std::ofstream &file) {