M
Mike P. Wagner
I have a real world problem that I hope someone has solved. I
implementing a class in a kernel that stores (and reads) data
persistently. There is one underlying "raw IO" function that calls the
device. This function cannot be const (unless I lie) since it changes
persistent data.
But that means that none of my read functions can be const, since they
need to call the underlying "raw IO" function. Now that seems really
silly.
Is there a simple way to tell the compiler, "Look, when I call this
function with read requests, it's const"?
I know that I can goof around with typedefs and reinterpret_cast<> to
do this, but it seems like there must be a more elegant way to do
this.
It's not an exotic problem, is it?
Mike
implementing a class in a kernel that stores (and reads) data
persistently. There is one underlying "raw IO" function that calls the
device. This function cannot be const (unless I lie) since it changes
persistent data.
But that means that none of my read functions can be const, since they
need to call the underlying "raw IO" function. Now that seems really
silly.
Is there a simple way to tell the compiler, "Look, when I call this
function with read requests, it's const"?
I know that I can goof around with typedefs and reinterpret_cast<> to
do this, but it seems like there must be a more elegant way to do
this.
It's not an exotic problem, is it?
Mike