diff options
author | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2009-04-08 16:21:28 +0000 |
---|---|---|
committer | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2009-04-08 16:21:28 +0000 |
commit | 568a7ce9ff56c206f3ecb88f3a59c26a4ecba185 (patch) | |
tree | 2cb89e32574db3e28ef29864012acbbc007d1474 /data_sets | |
parent | 61ee2ce37185c2b5b8b6d70064d80a0acabdfba5 (diff) | |
download | opt-utilities-568a7ce9ff56c206f3ecb88f3a59c26a4ecba185.tar.bz2 |
git-svn-id: file:///home/svn/opt_utilities@24 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'data_sets')
-rw-r--r-- | data_sets/default_data_set.hpp | 54 | ||||
-rw-r--r-- | data_sets/sorted_data_set.hpp | 72 |
2 files changed, 63 insertions, 63 deletions
diff --git a/data_sets/default_data_set.hpp b/data_sets/default_data_set.hpp index 887e3d2..4d0b89e 100644 --- a/data_sets/default_data_set.hpp +++ b/data_sets/default_data_set.hpp @@ -7,40 +7,40 @@ namespace opt_utilities { -template <typename Ty,typename Tx> -class default_data_set - :public data_set<Ty,Tx> -{ -private: - std::vector<data<Ty,Tx> > data_vec; - - data_set<Ty,Tx>* do_clone()const + template <typename Ty,typename Tx> + class default_data_set + :public data_set<Ty,Tx> { - return new default_data_set<Ty,Tx>(*this); - } + private: + std::vector<data<Ty,Tx> > data_vec; + + data_set<Ty,Tx>* do_clone()const + { + return new default_data_set<Ty,Tx>(*this); + } - const data<Ty,Tx>& do_get_data(size_t i)const - { - return data_vec.at(i); - } + const data<Ty,Tx>& do_get_data(size_t i)const + { + return data_vec.at(i); + } - size_t do_size()const - { - return data_vec.size(); - } + size_t do_size()const + { + return data_vec.size(); + } - void do_add_data(const data<Ty,Tx>& d) - { - data_vec.push_back(d); - } + void do_add_data(const data<Ty,Tx>& d) + { + data_vec.push_back(d); + } - void do_clear() - { - data_vec.clear(); - } + void do_clear() + { + data_vec.clear(); + } -}; + }; } #endif diff --git a/data_sets/sorted_data_set.hpp b/data_sets/sorted_data_set.hpp index f12edac..0512f18 100644 --- a/data_sets/sorted_data_set.hpp +++ b/data_sets/sorted_data_set.hpp @@ -14,43 +14,43 @@ namespace opt_utilities } -template <typename Ty,typename Tx> -class sorted_data_set - :public data_set<Ty,Tx> -{ -private: - std::vector<data<Ty,Tx> > data_vec; - - data_set<Ty,Tx>* do_clone()const - { - return new sorted_data_set<Ty,Tx>(*this); - } - - - const data<Ty,Tx>& do_get_data(size_t i)const - { - return data_vec.at(i); - } - - size_t do_size()const - { - return data_vec.size(); - } - - void do_add_data(const data<Ty,Tx>& d) - { - typename std::vector<data<Ty,Tx> >::iterator p - =std::lower_bound(data_vec.begin(),data_vec.end(),d,comp_data<Ty,Tx>); - //data_vec.push_back(d); - data_vec.insert(p,d); - } - - void do_clear() + template <typename Ty,typename Tx> + class sorted_data_set + :public data_set<Ty,Tx> { - data_vec.clear(); - } - -}; + private: + std::vector<data<Ty,Tx> > data_vec; + + data_set<Ty,Tx>* do_clone()const + { + return new sorted_data_set<Ty,Tx>(*this); + } + + + const data<Ty,Tx>& do_get_data(size_t i)const + { + return data_vec.at(i); + } + + size_t do_size()const + { + return data_vec.size(); + } + + void do_add_data(const data<Ty,Tx>& d) + { + typename std::vector<data<Ty,Tx> >::iterator p + =std::lower_bound(data_vec.begin(),data_vec.end(),d,comp_data<Ty,Tx>); + //data_vec.push_back(d); + data_vec.insert(p,d); + } + + void do_clear() + { + data_vec.clear(); + } + + }; } #endif |