class texture
{
...
struct bind
{
bind( texture *t )
{
// enable texturing
// bind
}
~bind( void )
{
// disable texturing
// unbind
}
};
...
};
Then i was hoping to be able to use it like
void foo( void )
{
texture::bind( bar ); // texture bound, texturing enabled
// do a bunch of stuff where after i will inevitably forget
// to disable textures
} // bind destructor called
I realize I could just create a temp object, but I dun wanna. Alternatives welcome.
[My site|SGI STL|Bjarne FAQ|C++ FAQ Lite|MSDN|Jargon]
Ripped off from various people [edited by - wild_pointer on April 13, 2003 4:45:11 AM]