It's definitely possible. If I understand you right, you don't want to
redefine int to occupy 3 bytes, but define a new data type which
occupies 3 bytes and behaves like an integer variable. You could do it
in several ways. The easiest implementation would be using a class.
Define a new class and define its behaviour using functions. You could
use 3 char vars to hold your values, but i believe, the size of char
differs on different architectures. You can use an array of bits and
push in values using bit masks or simple assignment. You can use
typedef to define a new type which does what you need. I'm not sure of
the implementation of this though. I think std::sort() only works and
is meant for abstract data structures like vectors and such, not on
elementary ones like int.

Sidhartha



On 06-Mar-2012, at 12:42 AM, bugos <[email protected]> wrote:

> Hello,
> is there a way to define my own data type, which will be idetical to
> an int, but just 3 bytes size? i must be able to use it as an int and
> even use std::sort() with it.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Code Jam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to