aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--container/driver.cxx6
-rw-r--r--container/person.hxx22
2 files changed, 14 insertions, 14 deletions
diff --git a/container/driver.cxx b/container/driver.cxx
index 07b3bd9..109fec0 100644
--- a/container/driver.cxx
+++ b/container/driver.cxx
@@ -23,7 +23,7 @@ print (const person& p)
// Print nicknames.
//
- for (person::name_list::const_iterator i (p.nicknames ().begin ());
+ for (names::const_iterator i (p.nicknames ().begin ());
i != p.nicknames ().end (); ++i)
{
cout << " nickname: " << *i << endl;
@@ -31,7 +31,7 @@ print (const person& p)
// Print emails.
//
- for (person::email_set::const_iterator i (p.emails ().begin ());
+ for (emails::const_iterator i (p.emails ().begin ());
i != p.emails ().end (); ++i)
{
cout << " email: " << *i << endl;
@@ -39,7 +39,7 @@ print (const person& p)
// Print weights.
//
- for (person::age_weight_map::const_iterator i (p.age_weight ().begin ());
+ for (age_weight_map::const_iterator i (p.age_weight ().begin ());
i != p.age_weight ().end (); ++i)
{
cout << " weight at " << i->first << ": " << i->second << endl;
diff --git a/container/person.hxx b/container/person.hxx
index f9160b8..941bfc6 100644
--- a/container/person.hxx
+++ b/container/person.hxx
@@ -12,6 +12,10 @@
#include <odb/core.hxx>
+typedef std::vector<std::string> names;
+typedef std::set<std::string> emails;
+typedef std::map<unsigned short, float> age_weight_map;
+
#pragma db object
class person
{
@@ -35,15 +39,13 @@ public:
// Nicknames.
//
- typedef std::vector<std::string> name_list;
-
- const name_list&
+ const names&
nicknames () const
{
return nicknames_;
}
- name_list&
+ names&
nicknames ()
{
return nicknames_;
@@ -51,15 +53,15 @@ public:
// Emails.
//
- typedef std::set<std::string> email_set;
+ typedef ::emails emails_type;
- const email_set&
+ const emails_type&
emails () const
{
return emails_;
}
- email_set&
+ emails_type&
emails ()
{
return emails_;
@@ -67,8 +69,6 @@ public:
// Age-to-weight map.
//
- typedef std::map<unsigned short, float> age_weight_map;
-
const age_weight_map&
age_weight () const
{
@@ -92,8 +92,8 @@ private:
std::string first_;
std::string last_;
- name_list nicknames_;
- email_set emails_;
+ names nicknames_;
+ emails_type emails_;
age_weight_map age_weight_;
};