P
P
Pinkman2021-12-07 23:14:26
C++ / C#
Pinkman, 2021-12-07 23:14:26

How to cast not in C style?

How to cast a non-C-style pointer?
The problem is this:

if (bind(socketFd_, (const sockaddr*)&info_, sizeof(info_)) < 0)
    throw ft::Socket::FailOnSocket("Cant bind Socket");

Here I cast struct sockaddr_into just sockaddr*But I don't understand how I can cast in c++ style? dynamic_cast and const_castthey don't help me?

I am writing in c++98, but I will be glad to hear about the solution in c++11 and higher.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Adamos, 2021-12-08
@famousman204

https://en.cppreference.com/w/cpp/language/reinter...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question