Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Post top tier code

Name: Anonymous 2014-07-22 13:29

Can be yours or not, I just want to see something good.

Name: Anonymous 2014-07-30 5:25

>>27
Ah, I forgot to overload []. Add these definitions (and appropriate declarations in the class declaration of course):
bitptr bitptr::operator+(int j) const {
bitptr val{ *this };
val += j;
return val;
}

bitptr bitptr::operator-(int j) const {
bitptr val{ *this };
val -= j;
return val;
}

bitref bitptr::operator[](int j) const {
return *(*this + j);
};


With this, you can dump the binary of "Hello world" to output, like this:
char s = "Hello world";
bitptr p{static_cast<void*>(s)};
for(int i = 0; i < 11*CHAR_BIT; i++)
std::cout << p[i] ? "1" : "0";
std::cout << std::endl;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List