Re: [eigen] Proposal for STL containers helper templates |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Proposal for STL containers helper templates
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 23 Nov 2010 14:02:38 -0500
- 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=gImljkwxX5nwCbGjk1dI/hB0jnmI+QuNZd/s3+CaTqU=; b=S1IwbSzrfchAvzzXCGs8RmnvNzE6E3uMryuzEXnOWv0IXv8p1CNkUiiQ4McflD81MJ rdDhGGGi5Z/WwW29u+a/Xm1nQ/2hExfTbKEIVvkzWfUmzUeDfUvdXHxfP2RVqnVvfOGb VlWeZ9erdSCiTYr5PdHNEZi58eMS5dupIHYbQ=
- 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=hDmnF/MsOYSHwQAncixavGJnDPtNDSyHTKQj2MjI5Kvdl4Fw7NOfYUjYhnDlPPtV6Q VAkvz8dqbjd/EyfZ/3grLuJUdJg4HQmtLhwQLapoqeNw549/AgEOPNQHO5TCbZE9BZQ+ foAL/3c49k8i0vl3R4DyglnqNjfNtXT6JHm/Y=
2010/11/20 Jose Luis Blanco <joseluisblancoc@xxxxxxxxx>:
> 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;
Not quite: you'd still need a typename keyword:
typename aligned_containers<int,MatrixXd>::map_t myVar;
I'm not really in favor of having this in Eigen: it's not our job to
make the STL's API easier, this is quite orthogonal to Eigen except
for the fact that we provide one STL allocator, and different users
may prefer different solutions (looks like a matter of taste).
Benoit
>
> 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/
> ___________________________________________________________
>
>
>