Robert Le Van Mao

PPC: problems with C++ templates

Discussion created by Robert Le Van Mao on May 4, 2011
Latest reply on May 6, 2011 by Tom Thompson

Hi All,


I am trying to cross-compile an application that uses std::tr1::tuple. I have this declaration in std::tr1 namespace:



template <int k, typename T0>


class tuple<T0> {...}


template <int k, typename T0> MyType



get(const tuple<T0>& t) {...}


When I tested with this code:


tuple<int> t;

int N = 1;


r = get<N-1>(t);



I got an error from mwcceppc.exe like what it cannot find get because it is looking for this:


get<0, tuple<int, std::tr1::nat, std::tr1::nat, ...>>(const tuple<int, std::tr1::nat, std::tr1::nat, ...>&)


I was expecting this instead:


get<0, tuple<int>>(const tuple<int>&)


I am wondering where is this padding std::tr1::nat come from? Could I tell the compiler to not insert the padding?


Your help is appreciated.


This case is compiled well with MSDEV-2008. mwcceppc.exe -version gave


Freescale C/C++ Compiler for Embedded PowerPC.
Copyright (c) 2007, Freescale Semiconductor, Inc.
All rights reserved.
Version 4.3 build 145
Runtime Built: Oct  9 2008 05:39:23


Robert Le Van Mao

Ubisoft - Montreal