|Re: [eigen] about std::vector::resize (again)|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] about std::vector::resize (again)
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Fri, 6 Feb 2009 19:50:13 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=j4GAfY23BnCdZVh2GwtcDDXUsSmExt6MFWoSkS/RDL8=; b=PvfU2WsdE3//vinSA5yVi4cJ7yHl6SrLIXszy5ztvKg7+OHPlQ+YyHzWX/3TyRihLW GD3vUfAp1fYggQnYXFlnDHu5FpPdtvKm7jtWLItR9FFjf6eZqs5EFAz4xr5sLfti6vSN W8N1hSFtZ76ew/n/ALbJNM382fcMQtVDd+85s=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Z4QnXU6qZoyYX5KhKXPRoxVAHz4ZMrmsQ4v1z/UgrKKSpe0VzxZFYXYJPmttG5PG/F Qw2+Vwq28YfoXYtHQN/tWX1ilotDp0vd9bks8HWCazMjSGbYqRHm9EP9IEExrmSTTWZj kap867hepOZr81ErXu5vcfx1gg3l5RnHSnK80=
2009/2/6 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
> std::vector<A,aligned_allocator> will fail because of bugged
> vector<T>::resize(size_t,T). Our current solution is OK for Eigen's
> types for which we workaround via several tricks. However this
> solution is not extensible to user types (have to add special
> constructor to discard the assertion, the specializations of
> std::vector cannot be automatically generated by a macro, etc..).
OK, I hadn't thought of that, makes sense.
> So here is what I propose: let's be ugly !
> #if define(_GLIBCXX_VECTOR) || define(_VECTOR_)
> #error you must include Eigen/StdVector before std::vector
ouch. I wanted to avoid that, but indeed it seems that we have no choice...
> yes I know this a bit ugly, but I don't know better solution to tackle
> this issue once for all. Of course this is just a starting point. If
> that really works, the next step is to have a specialization of
> std::vector for classes having EIGEN_MAKE_ALIGNED_OPERATOR_NEW (this
> is easy to detect), and do the workaround + "aligned_allocator as
> default" only in this specialization.
> I'll test it with MSVC tonight, and let you know.
Looking forward to see this working! I wonder how you'll detect
EIGEN_MAKE_ALIGNED_OPERATOR_NEW in a way that still compiles for
classes not having this macro?