Jump to page: 1 2 3
Thread overview
[stlsoft][fixed_array_1d<>] size overhead
Nov 30, 2007
Thorsten Ottosen
Dec 03, 2007
Thorsten Ottosen
Dec 04, 2007
Thorsten Ottosen
Dec 04, 2007
Thorsten Ottosen
Dec 08, 2007
Matthew Wilson
Dec 09, 2007
Thorsten Ottosen
Dec 09, 2007
Thorsten Ottosen
Dec 16, 2007
Thorsten Ottosen
Dec 16, 2007
Matthew Wilson
Dec 16, 2007
Matthew Wilson
Dec 17, 2007
Thorsten Ottosen
Dec 16, 2007
Matthew Wilson
Dec 16, 2007
Matthew Wilson
Dec 17, 2007
Thorsten Ottosen
Dec 04, 2007
Thorsten Ottosen
Dec 04, 2007
Thorsten Ottosen
Dec 04, 2007
Thorsten Ottosen
Dec 04, 2007
Thorsten Ottosen
Dec 05, 2007
Matthew Wilson
Dec 16, 2007
Matthew Wilson
Dec 17, 2007
Thorsten Ottosen
November 30, 2007
Hi Matthew,

I'm using the above class, but I was puzzled by the size occupied by the type (it was 12 bytes on my 32bit system).

I would like to get that down to 8 or 4 bytes. It turned out that the allocator (which the classes inherits from) takes up 4 bytes, even though it is in fact an empty class in many cases.

I think it should be possible to use something along boost's
compressed_pair:

http://www.boost.org/libs/utility/compressed_pair.htm

to hold the allocator and the size.

-Thorsten
December 03, 2007
Thorsten Ottosen skrev:
> Hi Matthew,
> 

Also, why does the classes not have a swap() member function?

best regards

-Thorsten
December 04, 2007
Thorsten Ottosen skrev:
> Thorsten Ottosen skrev:
>> Hi Matthew,
>>
> 
> Also, why does the classes not have a swap() member function?

Furthermore, I find that it would be useful if one could construct

  fixed_array_1d<T, A, P, false>

from

  fixed_array_1d<T, A, P, true>

(and similar for 2d, 3d, etc)

The reason is that it makes it possible to return the view type
fixed_array_1d<T, A, P, false> in a class hierarchy where some concrete classes uses, say, fixed_array_1d and some classes use fixed_array_2d.

best regards

-Thorsten
December 04, 2007
Thorsten Ottosen skrev:
> Thorsten Ottosen skrev:
>> Hi Matthew,
>>
> 
> Also, why does the classes not have a swap() member function?

Furthermore, I find that it would be useful if one could construct

  fixed_array_1d<T, A, P, false>

from

  fixed_array_1d<T, A, P, true>

(and similar for 2d, 3d, etc)

The reason is that it makes it possible to return the view type
fixed_array_1d<T, A, P, false> in a class hierarchy where some concrete classes uses, say, fixed_array_1d and some classes use fixed_array_2d.

best regards

-Thorsten
December 04, 2007
Thorsten Ottosen skrev:
> Thorsten Ottosen skrev:
>> Hi Matthew,
>>
> 
> Also, why does the classes not have a swap() member function?

Furthermore, I find that it would be useful if one could construct

  fixed_array_1d<T, A, P, false>

from

  fixed_array_1d<T, A, P, true>

(and similar for 2d, 3d, etc)

The reason is that it makes it possible to return the view type
fixed_array_1d<T, A, P, false> in a class hierarchy where some concrete classes uses, say, fixed_array_1d and some classes use fixed_array_2d.

best regards

-Thorsten
December 04, 2007
Thorsten Ottosen skrev:
> Thorsten Ottosen skrev:
>> Hi Matthew,
>>
> 
> Also, why does the classes not have a swap() member function?

Furthermore, I find that it would be useful if one could construct

  fixed_array_1d<T, A, P, false>

from

  fixed_array_1d<T, A, P, true>

(and similar for 2d, 3d, etc)

The reason is that it makes it possible to return the view type
fixed_array_1d<T, A, P, false> in a class hierarchy where some concrete classes uses, say, fixed_array_1d and some classes use fixed_array_2d.

best regards

-Thorsten
December 04, 2007
Thorsten Ottosen skrev:
> Thorsten Ottosen skrev:
>> Hi Matthew,
>>
> 
> Also, why does the classes not have a swap() member function?

Furthermore, I find that it would be useful if one could construct

  fixed_array_1d<T, A, P, false>

from

  fixed_array_1d<T, A, P, true>

(and similar for 2d, 3d, etc)

The reason is that it makes it possible to return the view type
fixed_array_1d<T, A, P, false> in a class hierarchy where some concrete classes uses, say, fixed_array_1d and some classes use fixed_array_2d.

best regards

-Thorsten
December 04, 2007
Thorsten Ottosen skrev:
> Thorsten Ottosen skrev:
>> Thorsten Ottosen skrev:
>>> Hi Matthew,
>>>
>>
>> Also, why does the classes not have a swap() member function?
> 
> Furthermore, I find that it would be useful if one could construct
> 
>   fixed_array_1d<T, A, P, false>
> 
> from
> 
>   fixed_array_1d<T, A, P, true>

[Sorry for the spamming ... I don't know exactly what went wrong]

There is another space optimization which is worth persuing: for

  fixed_array_1d<T, A, P, false>

there is never a need to store an allocator (by deriving from it).

I can submit a patch for all of these issues, if you agree on them.

best regards

-Thorsten
December 05, 2007
Thor

just want to let you know that I'm not ignoring. Will back to you in next few days.

cheers

Matt

"Thorsten Ottosen" <nesotto@cs.aau.dk> wrote in message news:fiomkl$2koh$1@digitalmars.com...
> Hi Matthew,
>
> I'm using the above class, but I was puzzled by the size occupied by the type (it was 12 bytes on my 32bit system).
>
> I would like to get that down to 8 or 4 bytes. It turned out that the allocator (which the classes inherits from) takes up 4 bytes, even though it is in fact an empty class in many cases.
>
> I think it should be possible to use something along boost's compressed_pair:
>
> http://www.boost.org/libs/utility/compressed_pair.htm
>
> to hold the allocator and the size.
>
> -Thorsten


December 08, 2007
Please submit patch, and I'll integrate everything I don't disagree with. :-)

btw, just for my information: what are you using them for? Something to do with you PhD?

"Thorsten Ottosen" <nesotto@cs.aau.dk> wrote in message news:4755D786.3000702@cs.aau.dk...
> Thorsten Ottosen skrev:
> > Thorsten Ottosen skrev:
> >> Thorsten Ottosen skrev:
> >>> Hi Matthew,
> >>>
> >>
> >> Also, why does the classes not have a swap() member function?
> >
> > Furthermore, I find that it would be useful if one could construct
> >
> >   fixed_array_1d<T, A, P, false>
> >
> > from
> >
> >   fixed_array_1d<T, A, P, true>
>
> [Sorry for the spamming ... I don't know exactly what went wrong]
>
> There is another space optimization which is worth persuing: for
>
>    fixed_array_1d<T, A, P, false>
>
> there is never a need to store an allocator (by deriving from it).
>
> I can submit a patch for all of these issues, if you agree on them.
>
> best regards
>
> -Thorsten


« First   ‹ Prev
1 2 3