diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-04 13:32:25 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-04 13:32:25 +0200 |
commit | b2fcd4dcdeb0f4962f8c8a1ce1a6fd64c2014062 (patch) | |
tree | 2cb2e003bc5865e0f36df9a3c1ddbc0991b1f154 /boost/employee.hxx | |
parent | f2955b7052e571eb4af0ad8194970f29e4b4ff9b (diff) |
Add support for boost::optional and boost::shared_ptr as value wrappers
New test: boost/common/optional.
Diffstat (limited to 'boost/employee.hxx')
-rw-r--r-- | boost/employee.hxx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/boost/employee.hxx b/boost/employee.hxx index ffa017e..952f065 100644 --- a/boost/employee.hxx +++ b/boost/employee.hxx @@ -10,6 +10,7 @@ #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> +#include <boost/optional.hpp> #include <boost/unordered_set.hpp> #include <boost/date_time/gregorian/gregorian.hpp> @@ -86,7 +87,20 @@ public: const std::string& last, const date& born, shared_ptr<employer_type> employer) - : first_ (first), last_ (last), born_ (born), employer_ (employer) + : first_ (first), last_ (last), + born_ (born), + employer_ (employer) + { + } + + employee (const std::string& first, + const std::string& middle, + const std::string& last, + const date& born, + shared_ptr<employer_type> employer) + : first_ (first), middle_ (middle), last_ (last), + born_ (born), + employer_ (employer) { } @@ -98,6 +112,12 @@ public: return first_; } + const boost::optional<std::string>& + middle () const + { + return middle_; + } + const std::string& last () const { @@ -151,6 +171,7 @@ private: unsigned long id_; std::string first_; + boost::optional<std::string> middle_; std::string last_; date born_; |