diff --git a/compatible_edition/include/st_asio_wrapper.h b/compatible_edition/include/st_asio_wrapper.h index 199be78207ac27b758f489e3d7f5b97ed4c26269..ccba63f308cd019892ba0c3291cf6a2ed436fa0d 100644 --- a/compatible_edition/include/st_asio_wrapper.h +++ b/compatible_edition/include/st_asio_wrapper.h @@ -24,7 +24,7 @@ #ifdef _MSC_VER #if _MSC_VER >= 1600 - #warning Your compiler is Visual C++ 10.0 or higher, you can use the standard edition to gain some performance improvement. + #pragma message("Your compiler is Visual C++ 10.0 or higher, you can use the standard edition to gain some performance improvement.") #endif #elif defined(__GNUC__) //After a roughly reading from gcc.gnu.org and clang.llvm.org, I believed that the minimum version of GCC and Clang that support c++0x diff --git a/compatible_edition/include/st_asio_wrapper_base.h b/compatible_edition/include/st_asio_wrapper_base.h index 08d406450d35a0a83fe31f5e59ffaf996af507b9..69dea7ff3b8e748c3ae27ec57c34cbc6a45b2bfc 100644 --- a/compatible_edition/include/st_asio_wrapper_base.h +++ b/compatible_edition/include/st_asio_wrapper_base.h @@ -157,9 +157,6 @@ public: protected: buffer_type buffer; }; -typedef auto_buffer replaceable_buffer; -//replaceable_packer and replaceable_unpacker used replaceable_buffer as their msg type, so they're replaceable, -//shared_buffer is available too. //convert '->' operation to '.' operation //user need to allocate object, and shared_buffer will free it @@ -193,6 +190,9 @@ protected: }; //not like auto_buffer, shared_buffer is copyable, but auto_buffer is a bit more efficient. +typedef auto_buffer replaceable_buffer; +//packer or/and unpacker used replaceable_buffer (or shared_buffer) as their msg type will be replaceable. + //packer concept template class i_packer diff --git a/file_server/file_server.cpp b/file_server/file_server.cpp index 7b30fd15760b6f106da37de6f53f89db8c8c0861..c6ab086ff7ab441e768bf2eacd624859f453c4ca 100644 --- a/file_server/file_server.cpp +++ b/file_server/file_server.cpp @@ -12,11 +12,7 @@ //but file_server only receive talking message, not send talking message proactively), the previous message has been //sent to file_client, so sending buffer will always be empty, which means we will never operate sending buffer concurrently, //so need no locks. -#if !defined(_MSC_VER) || _MSC_VER > 1800 -#define ST_ASIO_DEFAULT_PACKER replaceable_packer<> //before C++ 14.0, auto_buffer will lead compilation error, who can tell me why? -#else -#define ST_ASIO_DEFAULT_PACKER replaceable_packer> -#endif +#define ST_ASIO_DEFAULT_PACKER replaceable_packer<> //configuration #include "../include/st_asio_wrapper_server.h" diff --git a/file_server/file_socket.cpp b/file_server/file_socket.cpp index d0a2fd9cc845198493148a78bd012632103be7db..2e639f15c7d05d40bff96e6a469fb6b85dc24845 100644 --- a/file_server/file_socket.cpp +++ b/file_server/file_socket.cpp @@ -10,11 +10,7 @@ //but file_server only receive talking message, not send talking message proactively), the previous message has been //sent to file_client, so sending buffer will always be empty, which means we will never operate sending buffer concurrently, //so need no locks. -#if !defined(_MSC_VER) || _MSC_VER > 1800 -#define ST_ASIO_DEFAULT_PACKER replaceable_packer<> //before C++ 14.0, auto_buffer will lead compilation error, who can tell me why? -#else -#define ST_ASIO_DEFAULT_PACKER replaceable_packer> -#endif +#define ST_ASIO_DEFAULT_PACKER replaceable_packer<> //configuration #include "file_socket.h" diff --git a/include/st_asio_wrapper_base.h b/include/st_asio_wrapper_base.h index 50c46f76a7fd22c30018c9377ba27f7d36433a27..46f008973dd2cdbf91f38c7acf1bd926b81ef4ce 100644 --- a/include/st_asio_wrapper_base.h +++ b/include/st_asio_wrapper_base.h @@ -154,9 +154,6 @@ public: protected: buffer_type buffer; }; -typedef auto_buffer replaceable_buffer; -//replaceable_packer and replaceable_unpacker used replaceable_buffer as their msg type, so they're replaceable, -//shared_buffer is available too. //convert '->' operation to '.' operation //user need to allocate object, and shared_buffer will free it @@ -193,6 +190,13 @@ protected: }; //not like auto_buffer, shared_buffer is copyable, but auto_buffer is a bit more efficient. +#if !defined(_MSC_VER) || _MSC_VER > 1800 +typedef auto_buffer replaceable_buffer; +#else +typedef shared_buffer replaceable_buffer; //before C++ 14.0, auto_buffer will lead compilation error, who can tell me why? +#endif +//packer or/and unpacker used replaceable_buffer as their msg type will be replaceable. + //packer concept template class i_packer