From fdb2b7d0e05bac9443838434b46af2d9049241db Mon Sep 17 00:00:00 2001 From: Davis King Date: Thu, 18 Nov 2010 01:05:28 +0000 Subject: [PATCH] Moved serialize definition outside class since some compilers will fail to compile friend functions when they aren't declared in this way. --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403908 --- dlib/rand/rand_kernel_1.h | 29 +++++++++++++++++++---------- dlib/test/rand.cpp | 1 + 2 files changed, 20 insertions(+), 10 deletions(-) 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;