From 0e23db7f929a6961c63a04148cb3f0949c3c4494 Mon Sep 17 00:00:00 2001 From: tayral Date: Fri, 28 Feb 2014 17:25:52 +0000 Subject: [PATCH] Added constructor of observable on binned_series --- triqs/statistics/statistics.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/triqs/statistics/statistics.hpp b/triqs/statistics/statistics.hpp index 01bf89f7..73726429 100644 --- a/triqs/statistics/statistics.hpp +++ b/triqs/statistics/statistics.hpp @@ -64,6 +64,10 @@ namespace statistics { value_type operator[](int i) const { return binned[i]; } int size() const { return binned.size(); } + std::vector const & data() const & { return binned;} + std::vector const & data() & { return binned;} + std::vector data() && { return std::move(binned);} + using const_iterator = typename std::vector::const_iterator; const_iterator begin() const { return binned.begin(); } const_iterator end() const { return binned.end(); } @@ -171,6 +175,8 @@ namespace statistics { public: observable() { _series.reserve(1000); } + observable(binned_series && s):_series(std::move(s).data()){} + observable& operator<<(T x) { // copy and move : check speed ... or overload const &, && _series.push_back(std::move(x)); return *this;