Commit c4af79f7 authored by Pavel Vainerman's avatar Pavel Vainerman

(2.0): Попытка оптимизиировать конструктор VoidMessage()

parent df03c628
...@@ -63,6 +63,10 @@ namespace UniSetTypes ...@@ -63,6 +63,10 @@ namespace UniSetTypes
Message(); Message();
// для оптимизации, делаем конструктор который не будет инициализировать свойства класса
// это необходимо для VoidMessage, который конструируется при помощи memcpy
Message( int dummy_init ){}
template<class In> template<class In>
static TransportMessage transport(const In& msg) static TransportMessage transport(const In& msg)
{ {
......
...@@ -57,7 +57,8 @@ TransportMessage Message::transport(const In &msg) ...@@ -57,7 +57,8 @@ TransportMessage Message::transport(const In &msg)
*/ */
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
VoidMessage::VoidMessage( const TransportMessage& tm ) VoidMessage::VoidMessage( const TransportMessage& tm ):
Message(1) // вызываем dummy-конструктор
{ {
assert(sizeof(VoidMessage)>=sizeof(UniSetTypes::RawDataOfTransportMessage)); assert(sizeof(VoidMessage)>=sizeof(UniSetTypes::RawDataOfTransportMessage));
memcpy(this,&tm.data,sizeof(tm.data)); memcpy(this,&tm.data,sizeof(tm.data));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment