我正在使用该GetAdapterAddresses()方法获取系统上所有接口的IP地址.
我需要找到每个接口的广播地址.我可以使用IP地址和子网掩码来计算,但我无法在IP_ADAPTER_ADDRESSES结构中看到子网掩码.
有没有办法检索子网掩码使用GetAdapterAddresses()?
当我编译这段代码时:
#include <type_traits>
template <typename T>
void do_stuff(std::enable_if_t<std::is_integral<T>::value, T> &t) {}
template <typename T>
void do_stuff(std::enable_if_t<std::is_class<T>::value, T> &t) {}
int main() {
int i = 1;
do_stuff(i);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
GCC说:
37325975.cpp: In function ‘int main()’:
37325975.cpp:11:15: error: no matching function for call to ‘do_stuff(int&)’
do_stuff(i);
^
37325975.cpp:4:6: note: candidate: template<class T> void do_stuff(std::enable_if_t<std::is_integral<_Tp>::value, T>&)
void do_stuff(std::enable_if_t<std::is_integral<T>::value, T> &t) {}
^
37325975.cpp:4:6: note: template argument deduction/substitution failed:
37325975.cpp:11:15: note: couldn't deduce template parameter ‘T’
do_stuff(i);
^
37325975.cpp:7:6: note: candidate: template<class …Run Code Online (Sandbox Code Playgroud) 我有一个字符串(十六进制),如:
717765717777716571a7202020
Run Code Online (Sandbox Code Playgroud)
我需要把它变成格式:
0x71,0x77,0x65,0x71,0x77,0x77...
Run Code Online (Sandbox Code Playgroud)
我不确定最好的方法是什么