Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2 TcpSocket::Send parameter not const  (Read 2095 times)

0 Members and 1 Guest are viewing this topic.

bloodust

  • Newbie
  • *
  • Posts: 1
    • View Profile
SFML 2 TcpSocket::Send parameter not const
« on: March 23, 2011, 09:49:35 am »
Why is the parameter not const in this function ?
Code: [Select]
Socket::Status TcpSocket::Send(Packet& packet)
Why is this member function not const? It does not modify the object and it returns const data.
Code: [Select]
const char* Packet::OnSend(std::size_t& size)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2 TcpSocket::Send parameter not const
« Reply #1 on: March 23, 2011, 10:03:56 am »
It's not const so that derived Packet classes can implement in-place modifications, rather than being forced to copy their data on every call to Send().
Laurent Gomila - SFML developer

 

anything