Hi On Mon, Mar 5, 2012 at 8:27 PM, Sidhartha Mani <[email protected]>wrote:
> You could > use 3 char vars to hold your values, but i believe, the size of char > differs on different architectures. > AFAIR size of char is always 1 byte in C/C++ and it doesn't matter what architecture you are using. 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. > You can use std::sort for sorting arrays, example is even on wikipedia [1] If you write your own class, it's enough to write proper comparison function and use second version of std::sort [2] If I may ask - why do you need 3-byte 'int' ? Best, D. [1] http://en.wikipedia.org/wiki/Sort_(C%2B%2B) [2] http://www.cplusplus.com/reference/algorithm/sort/ > 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. > > -- 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.
