C
Christopher Benson-Manica
hack_tick said:struct Tmp
{
int iVar[20] : 1; // each element of Aray having size as 1-BIT
}
any suggestions ???
Yes - vector<bool>.
hack_tick said:struct Tmp
{
int iVar[20] : 1; // each element of Aray having size as 1-BIT
}
any suggestions ???
hack_tick said:hi there
I was looking for some way to use bit field with Arrays
something similar to
struct Tmp
{
int iVar[20] : 1; // each element of Aray having size as 1-BIT
}
it is possible ??
any suggestions ???
-regards
hack_tick said:hi there
I was looking for some way to use bit field with Arrays
something similar to
struct Tmp
{
int iVar[20] : 1; // each element of Aray having size as 1-BIT
}
it is possible ??
No.
any suggestions ???
hi there
I was looking for some way to use bit field with Arrays
something similar to
struct Tmp
{
int iVar[20] : 1; // each element of Aray having size as 1-BIT
}
it is possible ??
any suggestions ???
hack_tick said:hi there
Christopher Benson-Manica said:hack_tick <[email protected]> spoke thus: [...]
Yes - vector<bool>.
thanks for the suggestion, but sorry i didnt mentioned in my earlier post
that
I m working on Symbian Series 60 platform, and the struct is a part of
protocol which i m using over Bluetooth for communication which is already
tooooo heavy so i was looking for some way to reduce the size by using
bitfield, also Symbian Series 60 have few bugs and issued with STL so i
usually tend to avoid STL with my applications.
regards
Christopher Benson-Manica said:hack_tick <[email protected]> spoke thus: [...]
Yes - vector<bool>.
tom_usenet said:hi there
I was looking for some way to use bit field with Arrays
something similar to
struct Tmp
{
int iVar[20] : 1; // each element of Aray having size as 1-BIT
}
it is possible ??
Not like that, no.
any suggestions ???
struct Tmp
{
std::bitset<20> iVar;
};
If you need Tmp to be a POD type, you could code your own POD version
of bitset. OTOH, bitset is close enough to a POD type to work with
memcpy with normal compilers.
Tom
What is POD?
Like RAII?
tom_usenet said:hi there
I was looking for some way to use bit field with Arrays
something similar to
struct Tmp
{
int iVar[20] : 1; // each element of Aray having size as 1-BIT
}
it is possible ??
Not like that, no.
any suggestions ???
struct Tmp
{
std::bitset<20> iVar;
};
If you need Tmp to be a POD type, you could code your own POD version
of bitset. OTOH, bitset is close enough to a POD type to work with
memcpy with normal compilers.
Tom
What is POD?
Like RAII?
tom_usenet said:tom_usenet said:hi there
I was looking for some way to use bit field with Arrays
something similar to
struct Tmp
{
int iVar[20] : 1; // each element of Aray having size as 1-BIT
}
it is possible ??
Not like that, no.
any suggestions ???
struct Tmp
{
std::bitset<20> iVar;
};
If you need Tmp to be a POD type, you could code your own POD version
of bitset. OTOH, bitset is close enough to a POD type to work with
memcpy with normal compilers.
Tom
What is POD?
Like RAII?
In addition to what Sumit posted, the key thing about PODs is that you
can memcpy them around, which makes them easy to serialize, etc.
Tom
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.