diff --git a/dlib/rand/rand_kernel_1.h b/dlib/rand/rand_kernel_1.h index c545b5bd1..02faeb131 100644 --- a/dlib/rand/rand_kernel_1.h +++ b/dlib/rand/rand_kernel_1.h @@ -114,20 +114,12 @@ namespace dlib friend void serialize( const rand_kernel_1& item, std::ostream& out - ) - { - serialize(item.mt, out); - serialize(item.seed, out); - } + ); friend void deserialize( rand_kernel_1& item, std::istream& in - ) - { - deserialize(item.mt, in); - deserialize(item.seed, in); - } + ); private: mt19937 mt; @@ -148,6 +140,23 @@ namespace dlib static const bool value = true; }; + inline void serialize( + const rand_kernel_1& item, + std::ostream& out + ) + { + serialize(item.mt, out); + serialize(item.seed, out); + } + + inline void deserialize( + rand_kernel_1& item, + std::istream& in + ) + { + deserialize(item.mt, in); + deserialize(item.seed, in); + } } #endif // DLIB_RAND_KERNEl_1_ diff --git a/dlib/test/rand.cpp b/dlib/test/rand.cpp index 36576dc44..1c39b26cf 100644 --- a/dlib/test/rand.cpp +++ b/dlib/test/rand.cpp @@ -218,6 +218,7 @@ namespace { dlog << LINFO << "testing kernel_1a"; rand_test(); + rand_test(); } } a;