#include #include #include namespace po = boost::program_options ; namespace foo { class myclass { public: friend std::ostream& operator<<(std::ostream &, myclass const &) ; } ; std::ostream& operator<<(std::ostream &out, myclass const & l){return out ;} namespace bar { class anotherclass { public: friend std::ostream& operator<<(std::ostream &,anotherclass const &) ; } ; std::ostream& operator<<(std::ostream &out, anotherclass const & l){return out ;} void validate(boost::any& v, const std::vector& values, anotherclass*, int) { } } ; using namespace foo ; using namespace foo::bar ; void validate(boost::any& v, const std::vector& values, myclass*, int) { } void validate(boost::any& v, const std::vector& values, anotherclass*, int) { } class options { public: options() { generic_options_.add_options() ("option1", po::value(&myclass_obj), "test") ("option2", po::value(&anotherclass_obj), "test") ; } private: myclass myclass_obj ; anotherclass anotherclass_obj ; po::options_description generic_options_ ; } ; } ; int main(int argc, char** argv) { foo::options opts_() ; }