Made the normalized_function object fully generic by making the

normalizer a template argument (with its default set to the vector_normalizer
so this change doesn't break backwards compatibility).

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403102
This commit is contained in:
Davis King 2009-06-26 13:33:32 +00:00
parent 002683b1fa
commit d738ffde30
2 changed files with 11 additions and 7 deletions

View File

@ -363,7 +363,8 @@ namespace dlib
// ----------------------------------------------------------------------------------------
template <
typename function_type
typename function_type,
typename normalizer_type = vector_normalizer<typename function_type::sample_type>
>
struct normalized_function
{
@ -372,7 +373,7 @@ namespace dlib
typedef typename function_type::sample_type sample_type;
typedef typename function_type::mem_manager_type mem_manager_type;
vector_normalizer<sample_type> normalizer;
normalizer_type normalizer;
function_type function;
normalized_function (

View File

@ -364,7 +364,8 @@ namespace dlib
// ----------------------------------------------------------------------------------------
template <
typename function_type
typename function_type,
typename normalizer_type = vector_normalizer<typename function_type::sample_type>
>
struct normalized_function
{
@ -373,12 +374,14 @@ namespace dlib
- function_type must be a function object with an overloaded
operator() similar to the other function objects defined in
this file.
- function_type::sample_type must be a dlib::matrix column
matrix type
REQUIREMENTS ON normalizer_type
- normalizer_type must be a function object with an overloaded
operator() that takes a sample_type and returns a sample_type.
WHAT THIS OBJECT REPRESENTS
This object represents a container for another function
object and an instance of the vector_normalizer object.
object and an instance of a normlizer function.
It automatically noramlizes all inputs before passing them
off to the contained function object.
@ -389,7 +392,7 @@ namespace dlib
typedef typename function_type::sample_type sample_type;
typedef typename function_type::mem_manager_type mem_manager_type;
vector_normalizer<sample_type> normalizer;
normalizer_type normalizer;
function_type function;
normalized_function (