You need to sign in or sign up before continuing.
Commit 97300eb3 authored by Davis King's avatar Davis King

Moved the definition of the serialization friend functions out of the

vector_normalizer class because apparently not defining them this way prevents
someone from being able to invoke them by saying dlib::serialize().

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403391
parent 7351113c
...@@ -232,8 +232,46 @@ namespace dlib ...@@ -232,8 +232,46 @@ namespace dlib
temp_out.swap(item.temp_out); temp_out.swap(item.temp_out);
} }
template <typename mt>
friend void deserialize ( friend void deserialize (
vector_normalizer& item, vector_normalizer<mt>& item,
std::istream& in
);
template <typename mt>
friend void serialize (
const vector_normalizer<mt>& item,
std::ostream& out
);
private:
// ------------------- private data members -------------------
matrix_type m, sd;
// This is just a temporary variable that doesn't contribute to the
// state of this object.
mutable matrix_type temp_out;
};
// ----------------------------------------------------------------------------------------
template <
typename matrix_type
>
inline void swap (
vector_normalizer<matrix_type>& a,
vector_normalizer<matrix_type>& b
) { a.swap(b); }
// ----------------------------------------------------------------------------------------
template <
typename matrix_type
>
void deserialize (
vector_normalizer<matrix_type>& item,
std::istream& in std::istream& in
) )
{ {
...@@ -249,8 +287,13 @@ namespace dlib ...@@ -249,8 +287,13 @@ namespace dlib
"a vector_normalizer object."); "a vector_normalizer object.");
} }
friend void serialize ( // ----------------------------------------------------------------------------------------
const vector_normalizer& item,
template <
typename matrix_type
>
void serialize (
const vector_normalizer<matrix_type>& item,
std::ostream& out std::ostream& out
) )
{ {
...@@ -261,25 +304,8 @@ namespace dlib ...@@ -261,25 +304,8 @@ namespace dlib
serialize(pca, out); serialize(pca, out);
} }
private: // ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ------------------- private data members -------------------
matrix_type m, sd;
// This is just a temporary variable that doesn't contribute to the
// state of this object.
mutable matrix_type temp_out;
};
template <
typename matrix_type
>
inline void swap (
vector_normalizer<matrix_type>& a,
vector_normalizer<matrix_type>& b
) { a.swap(b); }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
template < template <
......
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