From 568a7ce9ff56c206f3ecb88f3a59c26a4ecba185 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Wed, 8 Apr 2009 16:21:28 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@24 ed2142bd-67ad-457f-ba7c-d818d4011675 --- data_sets/default_data_set.hpp | 54 +++++++++++++++---------------- data_sets/sorted_data_set.hpp | 72 +++++++++++++++++++++--------------------- 2 files changed, 63 insertions(+), 63 deletions(-) (limited to 'data_sets') 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 -class default_data_set - :public data_set -{ -private: - std::vector > data_vec; - - data_set* do_clone()const + template + class default_data_set + :public data_set { - return new default_data_set(*this); - } + private: + std::vector > data_vec; + + data_set* do_clone()const + { + return new default_data_set(*this); + } - const data& do_get_data(size_t i)const - { - return data_vec.at(i); - } + const data& 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& d) - { - data_vec.push_back(d); - } + void do_add_data(const data& 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 -class sorted_data_set - :public data_set -{ -private: - std::vector > data_vec; - - data_set* do_clone()const - { - return new sorted_data_set(*this); - } - - - const data& 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& d) - { - typename std::vector >::iterator p - =std::lower_bound(data_vec.begin(),data_vec.end(),d,comp_data); - //data_vec.push_back(d); - data_vec.insert(p,d); - } - - void do_clear() + template + class sorted_data_set + :public data_set { - data_vec.clear(); - } - -}; + private: + std::vector > data_vec; + + data_set* do_clone()const + { + return new sorted_data_set(*this); + } + + + const data& 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& d) + { + typename std::vector >::iterator p + =std::lower_bound(data_vec.begin(),data_vec.end(),d,comp_data); + //data_vec.push_back(d); + data_vec.insert(p,d); + } + + void do_clear() + { + data_vec.clear(); + } + + }; } #endif -- cgit v1.2.2