Шаблоны конструкторов в нешаблоном классе C++ ⇐ C++
-
Anonymous
Шаблоны конструкторов в нешаблоном классе C++
I have a non-template class (Uart) and want to create template constructor. It needs to take another template class object (SafeQueue). Then this constructor will call another template function defined inside the class.
class signatures are given below;
class UartCommunication { public: UartCommunication(const char *port, speed_t baudRate); template UartCommunication(const char* port, speed_t baudRate, SendQueue& sendQueue, ReceiveQueue& receiveQueue, int pollingTime, bool sendIfReceived) { port_ = port; baudRate_ = baudRate; serial_fd_ = open(port_, O_RDWR | O_NOCTTY | O_NDELAY); if (serial_fd_ == -1) { std::cerr
Источник: https://stackoverflow.com/questions/781 ... te-class-c
I have a non-template class (Uart) and want to create template constructor. It needs to take another template class object (SafeQueue). Then this constructor will call another template function defined inside the class.
class signatures are given below;
class UartCommunication { public: UartCommunication(const char *port, speed_t baudRate); template UartCommunication(const char* port, speed_t baudRate, SendQueue& sendQueue, ReceiveQueue& receiveQueue, int pollingTime, bool sendIfReceived) { port_ = port; baudRate_ = baudRate; serial_fd_ = open(port_, O_RDWR | O_NOCTTY | O_NDELAY); if (serial_fd_ == -1) { std::cerr
Источник: https://stackoverflow.com/questions/781 ... te-class-c
Мобильная версия