[eigen] Re: Proposal for STL containers helper templates

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


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/
> ___________________________________________________________
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/