#ifndef MLPACK_IO_OPTION_IMPL_H
#define MLPACK_IO_OPTION_IMPL_H

#include "io.h"

namespace mlpack {

/*
 * @brief Registers a parameter with IO.  
 *    This allows the registration of parameters at program start.
 */
template<typename N>
Option<N>::Option(bool ignoreTemplate,
                N defaultValue,
                const char* identifier,
                const char* description,
                const char* parent,
                bool required) {
  if (ignoreTemplate)
    IO::Add(identifier, description, parent, required);
  else {
    IO::Add<N>(identifier, description, parent, required);

    // Create the full pathname to set the default value.
    std::string pathname = IO::SanitizeString(parent) + std::string(identifier);
    IO::GetParam<N>(pathname.c_str()) = defaultValue;
  }
}


/*
 * @brief Registers a flag parameter with IO.
 */
template<typename N>
Option<N>::Option(const char* identifier,
                  const char* description,
                  const char* parent) {
  IO::AddFlag(identifier, description, parent);

  // Set the default value (false).
  std::string pathname = IO::SanitizeString(parent) + std::string(identifier);
  IO::GetParam<bool>(pathname.c_str()) = false;
}

}; // namespace mlpack

#endif 

#ifndef MLPACK_IO_OPTION_IMPL_H
#define MLPACK_IO_OPTION_IMPL_H

#include "io.h"

namespace mlpack {

/*
 * @brief Registers a parameter with IO.  
 *    This allows the registration of parameters at program start.
 */
template<typename N>
Option<N>::Option(bool ignoreTemplate,
                N defaultValue,
                const char* identifier,
                const char* description,
                const char* parent,
                bool required) {
  if (ignoreTemplate)
    IO::Add(identifier, description, parent, required);
  else {
    IO::Add<N>(identifier, description, parent, required);

    //Create the full pathname.
    std::string pathname = IO::SanitizeString(parent) + std::string(identifier);
    IO::GetParam<N>(pathname.c_str()) = defaultValue;
  }
}


/*
 * @brief Registers a flag parameter with IO.
 */
template<typename N>
Option<N>::Option(const char* identifier,
                  const char* description,
                  const char* parent) {
  IO::AddFlag(identifier, description, parent);
}

}; // namespace mlpack

#endif 

--- 
+++ 
@@ -21,7 +21,7 @@
   else {
     IO::Add<N>(identifier, description, parent, required);
 
-    //Create the full pathname.
+    // Create the full pathname to set the default value.
     std::string pathname = IO::SanitizeString(parent) + std::string(identifier);
     IO::GetParam<N>(pathname.c_str()) = defaultValue;
   }
@@ -36,6 +36,10 @@
                   const char* description,
                   const char* parent) {
   IO::AddFlag(identifier, description, parent);
+
+  // Set the default value (false).
+  std::string pathname = IO::SanitizeString(parent) + std::string(identifier);
+  IO::GetParam<bool>(pathname.c_str()) = false;
 }
 
 }; // namespace mlpack
Set a default value for boolean options (false).

