Re: [eigen] Std Vector again |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Std Vector again
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Fri, 26 Jun 2009 14:55:42 +0200
- 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=WbpwT0FGq9uKbsVVn17O0fIN1WSeyLBhBirc47WoZ+E=; b=DEI3EslmjJhRhB+so+tVCAKhZ6K7n7GUepflyhATcUxVoIvZVwtrFLW5tAZuaJl91/ zEd4CL5T+Kttir/dkZXyl3bjp8FKVwVJkN9y9mzrT0HRs41142Yb3uPhX+vFZ9LA++2W XqB6mm2J6fEl8c4HkUMW1ouc+JzSEcH3eMOKA=
- 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=WrnG6k9prqjiWObNeACoKK8GxelEkQa/8kG3u1kXfwDlazqUTJ/IFieiHnZb2BEBJT wG2l+kEc/slMDLhOmT2BP/u1M6qn+iD64F6pk7dtGzdgfxvF+YZJZLsBV7UEJu3nsBkl A38mexY3RL1+GFRW3LqIzTcjGGMAJcniBccos=
2009/6/26 Keir Mierle <mierle@xxxxxxxxx>:
> I started porting libmv to eigen 2.0.3, and got many assert failures due to
> putting vectorized eigen types into std::vectors or structs (which went into
> std::vectors). Oddly enough, it worked fine before.
Indeed there have been incompatible changes in this area.
> I first addressed this by using the eigen allocator,
That would work for any other STL container, but not for std::vector,
because of a design flaw in std::vector::resize which takes a
value_type by value. Whence the StdVector header. In Eigen 2.0.3, it
takes care of specifying the allocator for you. (Not in the
development branch though).
> Then I tried switching to using the eigen specialization in Eigen/StdVector.
> That ended up being worse, because suddenly my header files had to be
> included in a certain order, or there would be mysterious runtime breakage.
The only requirement should be: include <Eigen/StdVector> before
including <vector>. Actually, <Eigen/StdVector> takes care of
including <vector> for you. all you have to do is replace <vector> by
<Eigen/StdVector>.
> I consider it important that headers can be included in any order.
Yep, would be nice, but we didn't have a choice. This flaw is being
addressed in C++0x by the way.
> So now I'm left with a tree half-converted to 2.0.3. I'm not sure where to
> go next.
Just include <Eigen/StdVector> instead of <vector> everywhere. Don't
bother about allocators for now, with 2.0.3 you don't have to.
> What about having an Eigen::vector<> class?
people want to be able to use standard containers....
Benoit