mirror of
https://github.com/gbdev/rgbds.git
synced 2026-10-06 12:15:39 +00:00
Remove unnecessary const_casting methods
This commit is contained in:
1 parent
0996a2f5ed
commit
c55dec254d
1 file changed
-8
@@ -41,15 +41,7 @@ public:
|
|||||||
return std::holds_alternative<std::filebuf>(_file) ? std::get<std::filebuf>(_file)
|
return std::holds_alternative<std::filebuf>(_file) ? std::get<std::filebuf>(_file)
|
||||||
: *std::get<std::streambuf *>(_file);
|
: *std::get<std::streambuf *>(_file);
|
||||||
}
|
}
|
||||||
std::streambuf const &operator*() const {
|
|
||||||
// The non-`const` version does not perform any modifications, so it's okay.
|
|
||||||
return **const_cast<File *>(this);
|
|
||||||
}
|
|
||||||
std::streambuf *operator->() { return &**this; }
|
std::streambuf *operator->() { return &**this; }
|
||||||
std::streambuf const *operator->() const {
|
|
||||||
// See the `operator*` equivalent.
|
|
||||||
return const_cast<File *>(this)->operator->();
|
|
||||||
}
|
|
||||||
|
|
||||||
char const *c_str(std::string const &path) const {
|
char const *c_str(std::string const &path) const {
|
||||||
return std::holds_alternative<std::filebuf>(_file) ? path.c_str()
|
return std::holds_alternative<std::filebuf>(_file) ? path.c_str()
|
||||||
|
|||||||
Reference in new issue
Block a user