clover/util: Fix construction of compat::vector with a general container as argument.
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 8 Oct 2014 17:01:26 +0000 (20:01 +0300)
committerFrancisco Jerez <currojerez@riseup.net>
Mon, 20 Oct 2014 07:33:01 +0000 (10:33 +0300)
src/gallium/state_trackers/clover/util/compat.hpp

index 7305577529317a9eb6bb4b1cba5d04a63cc7dcf2..ca5b8921a408d6816dbcc5cefaa4d22eec5da0d2 100644 (file)
@@ -80,8 +80,10 @@ namespace clover {
 
          template<typename C>
          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() {