From 1441a3c1bba542f318cfc0f4468ef34f97121a1d Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Wed, 8 Oct 2014 20:01:26 +0300 Subject: [PATCH] clover/util: Fix construction of compat::vector with a general container as argument. --- src/gallium/state_trackers/clover/util/compat.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/clover/util/compat.hpp b/src/gallium/state_trackers/clover/util/compat.hpp index 7305577..ca5b892 100644 --- a/src/gallium/state_trackers/clover/util/compat.hpp +++ b/src/gallium/state_trackers/clover/util/compat.hpp @@ -80,8 +80,10 @@ namespace clover { template vector(const C &v) : - p(alloc(v.size(), &*v.begin(), v.size())), - _size(v.size()) , _capacity(v.size()) { + p(alloc(v.size(), NULL, 0)), _size(0), + _capacity(v.size()) { + for (typename C::const_iterator it = v.begin(); it != v.end(); ++it) + new(&p[_size++]) T(*it); } ~vector() { -- 2.7.4