[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reverse in std_vector.hh

From: Han-Wen Nienhuys
Subject: Re: Reverse in std_vector.hh
Date: Thu, 07 Sep 2006 23:40:39 +0200
User-agent: Thunderbird (X11/20060905)

Ruud van Silfhout wrote:

I have made an extension for the reverse function in std_vector.hh. The code suggests to implement template specialisation for reverse vector<int>.
This is what I have done, plus specialisation for float and double vectors.
The code depends on the availability of memrev, which is not available on all platforms.So a check is required (during configure) to

on which platforms is it available?

address@hidden ~]$ grep memrev /usr/include/* /usr/include/c++/4.1.1/*/*
address@hidden ~]$

In case memrev is not available there are two options:
1. skip the specialized template implementation for <int> <float> <double> and keep the generic template code. This is what is implemented now. 2. implement a replacement for memrev. a simple replacement is added below. I don't know where to put it. seems like a good place.

it uses malloc to allocate memory for each item. This can also be done using alloca, which allocates memory on the stack and, as a consequence,

Why not simply swap byte by byte in an inner loop?


Han-Wen Nienhuys - address@hidden -

LilyPond Software Design
 -- Code for Music Notation

reply via email to

[Prev in Thread] Current Thread [Next in Thread]