What is CWinThread class? Explain its advantages. What is function regex and regex_search function?
What is CWinThread class? Explain its advantagesAt the beginning of every application has one and only one thread, called as primary thread. CWinApp which is the user derived class encapsulates this thread. In this case pointer to your CWinApp object is also a pointer to the CWinThread object for the primary thread. Once your application gets going, it can create as many new threads as it wants to manage various tasks. CWinApp is derived from CWinThread. It also allows multiple threads within given application. CWinThread supports two types of threads:
Worker threads- it has no message pump i.e. thread that performs background calculations
User interface threads- it has message pump i.e. messages received from system.
It can be declared as:
class CWinThread : public CCmdTarget
The advantages which it has is:
It can assign more than one thread at a time like a multi-threading system.
It terminates the application without any hassles.
What is function regex and regex_search function?Regex- Defines a template class to parse regular Expressions, and several template classes and functions to search text for matches to a regular expression object. It is represented as:
#include <regex>
Regex_search Function- it searches for a regular expression match and function returns true only if a search for its regular expression argument succeeds. It is represented as:-
std::cout << "search(string, \"abc\") == " << std::boolalpha
<< regex_search(std::string("a"), rx) << std::endl;