[eigen] Re: Proposal for STL containers helper templates |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] Re: Proposal for STL containers helper templates
- From: Jose Luis Blanco <joseluisblancoc@xxxxxxxxx>
- Date: Tue, 23 Nov 2010 19:51:50 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=JOnLtFMNr9tPoatBrlPtsS4RVOe7n313oHhz65htuXA=; b=SF3wFXwLxUSJrCNkQHEdruKlmMN96CEh+2nRikoE5+VXHLH4Y3tHD0t+W1pfjWMmkj DuBwQn6tkjtmnF5qeKzuvWrHnlklx1u9ZHORvaRJsrDrEjvJQjzlJheW51CzIKFm1Ys9 VVc3G4yzvHKWAzxiXAYx7rIp2+fU/WT449UAg=
- 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=iLVVEeZ1f0ZU17F8OfTXtsYJQ6T1LO68fd1jkKhpghQwj5PCLEGkQ1lFmxaEqjSXlp 6kzo95mAvV6lEkDn/vj6CBVo3oYSzDPtNe4gEfmSPx6ubyYwMpIMSL3hYNTqDM6wYkVJ jRCknjnMgvT+1mKoavdXmUAYnVo+Tqh5UvTnA=
Any though on this?
I'm interested in knowing if such a thing like this would make it into
Eigen3 so I don't have to replicate it in my code ;-)
Best,
JL
On Sat, Nov 20, 2010 at 1:46 PM, Jose Luis Blanco
<joseluisblancoc@xxxxxxxxx> wrote:
> Hi guys,
>
> I noticed that it can be a bit tedious to write all the STL allocator
> template arguments for the Eigen::alligned_allocator<>... especially
> for std::map's!!
>
> What do you think of adding this small helper to Eigen headers??
>
> template <class TYPE1,class TYPE2=TYPE1>
> struct aligned_containers
> {
> typedef std::vector<TYPE1, Eigen::aligned_allocator<TYPE1> > vector_t;
> typedef std::deque<TYPE1, Eigen::aligned_allocator<TYPE1> > deque_t;
> typedef std::map<TYPE1,TYPE2,std::less<TYPE1>,Eigen::aligned_allocator<std::pair<const
> TYPE1,TYPE2> > > map_t;
> typedef std::multimap<TYPE1,TYPE2,std::less<TYPE1>,Eigen::aligned_allocator<std::pair<const
> TYPE1,TYPE2> > > multimap_t;
> };
>
> It's small, would also avoid possible mismatches between TYPE1 and
> TYPE2, which appears 3 and 2 times each, and declaring aligned
> containers will be as easy as:
>
> aligned_containers<int,MatrixXd>::map_t myVar;
>
> Probably the best place to add this would be in src/StlSupport/*.
>
> Let me know your opinions!
> JL
>
> --
> ___________________________________________________________
>
> Dr. Jose-Luis Blanco-Claraco
> Dpt. Ing. Civil, Mat. y Fabric - Phone: +34 952 152435
> E.T.S.I. Industriales - Despacho 2.037
> Dpt. Ing. Sist. y Automática - Phone: +34 952 132848
> E.T.S.I. Telecomunicacion - Lab. 2.3.6
> Universidad de Malaga - Campus Universitario de Teatinos
> 29071 Malaga, Spain
> http://www.isa.uma.es/jlblanco
> http://www.mrpt.org/
> ___________________________________________________________
>