Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Network
»
const qualifier in send() function
Print
Pages: [
1
]
Author
Topic: const qualifier in send() function (Read 2103 times)
0 Members and 1 Guest are viewing this topic.
fr1ar
Newbie
Posts: 7
const qualifier in send() function
«
on:
May 14, 2014, 10:32:07 am »
Is it possible to make first argument type
const Packet&
in future releases?
It doesn't look like it can be modified.
Socket
::
Status
UdpSocket
::
send
(
Packet
&
packet,
const
IpAddress
&
remoteAddress,
unsigned
short
remotePort
)
Logged
Nexus
SFML Team
Hero Member
Posts: 6287
Thor Developer
Re: const qualifier in send() function
«
Reply #1 on:
May 14, 2014, 10:34:35 am »
It can, because of
onSend()
and
onReceive()
.
But I agree that this is not a very beautiful limitation, especially since these methods are not used in the very most cases. Maybe in the future we can find a design that works without inheritance.
Logged
Zloxx II
: action platformer
Thor Library
: particle systems, animations, dot products, ...
SFML Game Development
:
fr1ar
Newbie
Posts: 7
Re: const qualifier in send() function
«
Reply #2 on:
May 14, 2014, 10:51:49 am »
Ok, it's not a big problem, my workaround works fine
void
MySocket
::
send
(
const
Address
&
address,
const
sf
::
Packet
&
packet
)
{
_socket.
send
(
packet.
getData
(
)
, packet.
getDataSize
(
)
, address._ip, address._port
)
;
}
Logged
Laurent
Administrator
Hero Member
Posts: 32498
Re: const qualifier in send() function
«
Reply #3 on:
May 14, 2014, 11:01:52 am »
This is not how a packet is sent internally. You may end up with problems if you use this code.
Logged
Laurent Gomila - SFML developer
Print
Pages: [
1
]
SFML community forums
»
Help
»
Network
»
const qualifier in send() function