diff options
author | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2009-09-06 17:06:20 +0000 |
---|---|---|
committer | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2009-09-06 17:06:20 +0000 |
commit | 81860e1b50373d070ab8ff2a0d6e8bff44b0216a (patch) | |
tree | 9e04760538e8c467df770ec3cffc07b0aa98d8c6 /data_sets | |
parent | 6d41f389dc7681b15bd29764b4faa4598362e416 (diff) | |
download | opt-utilities-81860e1b50373d070ab8ff2a0d6e8bff44b0216a.tar.bz2 |
git-svn-id: file:///home/svn/opt_utilities@64 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'data_sets')
-rw-r--r-- | data_sets/sorted_data_set.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/data_sets/sorted_data_set.hpp b/data_sets/sorted_data_set.hpp index 2e0c3cc..034a442 100644 --- a/data_sets/sorted_data_set.hpp +++ b/data_sets/sorted_data_set.hpp @@ -61,6 +61,44 @@ namespace opt_utilities data_vec.clear(); } + public: + sorted_data_set() + {} + + sorted_data_set(const sorted_data_set<Ty,Tx>& rhs) + :data_vec(rhs.data_vec) + {} + + sorted_data_set& operator=(const sorted_data_set<Ty,Tx>& rhs) + { + data_vec=rhs.data_vec; + return *this; + } + + sorted_data_set(const data_set<Ty,Tx>& rhs) + { + for(int i=0;i<rhs.size();++i) + { + typename std::vector<data<Ty,Tx> >::iterator p + =std::lower_bound(data_vec.begin(),data_vec.end(),rhs.get_data(i),comp_data<Ty,Tx>); + //data_vec.push_back(d); + data_vec.insert(p,rhs.get_data(i)); + } + } + + sorted_data_set& operator=(const data_set<Ty,Tx>& rhs) + { + data_vec.clear(); + for(int i=0;i<rhs.size();++i) + { + typename std::vector<data<Ty,Tx> >::iterator p + =std::lower_bound(data_vec.begin(),data_vec.end(),rhs.get_data(i),comp_data<Ty,Tx>); + //data_vec.push_back(d); + data_vec.insert(p,rhs.get_data(i)); + } + return *this; + } + }; } |