This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, c++0x] Use decltype in libstdc++'s parallel/base.h


On Wed, Jun 25, 2008 at 11:56 PM, Douglas Gregor <dgregor@osl.iu.edu> wrote:
>
> On Wed, 2008-06-25 at 23:16 -0400, Chris Fairles wrote:
>> On Wed, Jun 25, 2008 at 8:32 PM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
>> > Hi Chris,
>> >
>> > you are raising an interesting issue. First blush the code in base.h seems indeed quite hackish and C++ is certainly moving toward good solutions for such kind of problems. My doubts:
>> >
>> > 1- Can you describe in a bit of detail the problems you are actually encountering? (seeing a long error message without context doesn't really help, ehm ;)
>>
>> Right. Sorry about that, here's the snippet:
>>
>> #include <parallel/algorithm>
>> #include <parallel/numeric>
>>
>> template<typename T, std::size_t N>
>> void parallel_sort_test(std::array<T,N> & data)
>> {
>>     __gnu_parallel::sort(data.begin(), data.end());
>> }
>>
>> Compiled with something like:
>> g++ -ftemplate-depth-128 -O0 -fno-inline -Wall --std=c++0x -pthread -fopenmp
>>
>> It looks like it doesn't recognize "typeof" as a keyword or builtin or
>> whatever it is.
>
> Right, because typeof is a GNU extension and you've disabled GNU
> extensions with -std=c++0x. Change that to -std=gnu++0x and typeof will
> work.
>
>        - Doug
>
>

Ah right. Been using c++0x so long I forgot what the difference is
between the two. Well that solves this issue (although decltype still
might be a better choice since it allows the parallel lib to work in
both c++0x and gnu++0x mode).

Chris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]