[eigen] Proposal for STL containers helper templates |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] Proposal for STL containers helper templates
- From: Jose Luis Blanco <joseluisblancoc@xxxxxxxxx>
- Date: Sat, 20 Nov 2010 13:46:28 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=17g+eA25opn6rPwXoN9annAtQ4/VsWjPm4URMz5eJuA=; b=c/wgl+Xbp7Bb+h/24J9eHAgWODaWMajqya/Gvrr+8jiH7kvpv0ev9RkJVfVd8NKRct Dnp9Go+H/2xFEPA5WF8Ml6E2DTVU84Qwkh8LRxayDZv5QY1vlRxLl+wd1heHOy7XyNdo Kx9wMBG2MTaRlGJL/SMEXKrjtX+FpPNh0pnHQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=guKWKc38WRlKq6hrYSSFR0YRKVYbJhzSz2ypqNB7iStNAXG4PwRgqcrhZapip6wVAR HVkeyKVF6sBaO50RUO1+VcouQvLIF8mMBdTeswuV7cDK/2dsa3VgtDWGW4rzxfX//lbk 5ONdGMS+C/Fsp3WgkaJ3EcEQE43hz0vf8hpI4=
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/
___________________________________________________________