Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Templated BitStream::operator << should take a reference to a const value #52

Open
SrTobi opened this issue Mar 6, 2015 · 0 comments
Open

Comments

@SrTobi
Copy link

SrTobi commented Mar 6, 2015

The BitStream has a << operator which simply takes any argument and redirects it to BitStream::Write(...):

template <class templateType>
BitStream& operator<<(BitStream& out, templateType& c)
{
    out.Write(c);
    return out;
}

c (or the value referenced) however will never be changed, so that c should be const. Then the following code becomes valid:

RakString some_str()
{
    ...
}

BitStream bs;
bs << MessageID(0);
bs << some_str();
SrTobi added a commit to SrTobi/RakNet that referenced this issue Mar 6, 2015
rhard pushed a commit to rhard/RakNet that referenced this issue Aug 20, 2021
…-guard

Added guard around NOMINMAX in case the user has a global define
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant