Mesa (master): clover/util: Fix construction of compat:: vector with a general container as argument.
Francisco Jerez
currojerez at kemper.freedesktop.org
Mon Oct 20 07:43:38 UTC 2014
Module: Mesa
Branch: master
Commit: 1441a3c1bba542f318cfc0f4468ef34f97121a1d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1441a3c1bba542f318cfc0f4468ef34f97121a1d
Author: Francisco Jerez <currojerez at riseup.net>
Date: Wed Oct 8 20:01:26 2014 +0300
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<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() {
More information about the mesa-commit
mailing list