Boost logo

Boost :

Subject: Re: [boost] How to structurate libraries ?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-01-18 08:07:40

Joel Falcou wrote:

> * Arch.Memory : Provides free function and STL compatible allocators for
> aligned memory allocation and a macro to add aligned new/delete support
> into classes. Basically a platform independant wrapper around
> posix_memalign and its ilk.

It is possible to do better than posix_memalign.
When you use posix_memalign, you do not provide the alignment
information when freeing the memory. This does reduce the efficiency of

In C++, however, you always know the alignment of the memory when you
free it.

> * Arch.Types: some low level traits and generation class including
> things like :
> -> make_integer that build an integer type able to hold at most N bytes
> and with a given signedness e.g : make_interger<3,signed>::type returns
> int32_t.

I'm fairly sure there is already a library that does just that.

> -> typed_bitfield that wraps a type T and a properly sized byte array
> and provide proper byte access operator[]. Useful for decomposing large
> types into bytes for low level operations.

aligned_storage from type traits?

> -> padded<T,N> that provides an Enveloppe/Letter class around type T
> and whose sizeof is so that it's padded to a multiple of 2^N. It reuses
> compressed_pair for empty-base class optimisation.

Again, aligned_storage?

> * Arch.SIMD : a SIMD computation library that provides a small scale
> binding to internal representation of a SIMD register on SIMD-enabled
> machine. Using Proto, a small DSEL is provided so one can write code like :
> vec<float> k = {5,5,5,5},r;
> r = ((2*k)/(3-k)).min();

How would it work without writing
vec<float, 4> k = {5, 5, 5, 5};

How can the minimum of a vector yield a vector?

And isn't that already provided by Boost.uBlas?

Boost list run by bdawes at, gregod at, cpdaniel at, john at