Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ thread incide class

#include <iostream>
#include <thread>

class foo
{
public:
    void make_foo_func_thread()
    {
        t=std::thread(&foo::foo_func, this);
        t.join();
    }

private:
    std::thread t;
    void foo_func() { std::cout << "Hello
"; }
};

int main()
{
    foo f;
    f.make_foo_func_thread();
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ function default argument 
Cpp :: c++ string to int 
Cpp :: initialize string with length c++ 
Cpp :: how to check a number in string 
Cpp :: sorting vector elements c++ 
Cpp :: cpp create lambda with recursion 
Cpp :: how to empty an array c++ 
Cpp :: 3d projection onto 2d plane algorithm 
Cpp :: inline in class in C++ 
Cpp :: Header for INT_MIN 
Cpp :: Palindrome String solution in c++ 
Cpp :: c++ get the line which call a function 
Cpp :: integer range in c++ 
Cpp :: c++ print out workds 
Cpp :: Find the biggest element in the array 
Cpp :: how many months have 31 days 
Cpp :: iterate vector c++ 
Cpp :: how to use custom array in c++ 
Cpp :: C++ continue with for loop 
Cpp :: c++ convert const char* to int 
Cpp :: stl c++ 
Cpp :: c++ random number 
Cpp :: define vector with size and value c++ 
Cpp :: c++ vector first element 
Cpp :: take a function argument 
Cpp :: initialise 2d vector in c++ 
Cpp :: Syntax for C++ Operator Overloading 
Cpp :: c++ little endian or big endian 
Cpp :: C++ cout iostream 
Cpp :: prime number program c++ 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =