# task_handle

[scheduler.task_handle]

An instance of `task_handle` type owns a deferred task object.

    namespace oneapi {
    namespace tbb {

       class task_handle {
       public:
           task_handle();
           task_handle(task_handle&& src);

           ~task_handle();

           task_handle& operator=(task_handle&& src);

           explicit operator bool() const noexcept;
       };

       bool operator==(task_handle const& h, std::nullptr_t) noexcept;
       bool operator==(std::nullptr_t, task_handle const& h) noexcept;

       bool operator!=(task_handle const& h, std::nullptr_t) noexcept;
       bool operator!=(std::nullptr_t, task_handle const& h) noexcept;

    } // namespace tbb
    } // namespace oneapi

## Member Functions

task_handle()

  Creates an empty `task_handle` object.

task_handle(task_handle &&src)

  Constructs `task_handle` object with the content of `src` using move semantics. `src` becomes empty after the construction.

~task_handle()

  Destroys the `task_handle` object and associated task if it exists.

task_handle &operator=(task_handle &&src)

  Replaces the content of `task_handle` object with the content of `src` using move semantics. `src` becomes empty after the assignment. The previously associated task object, if any, is destroyed before the assignment.

  Returns: Reference to `*this`.

explicit operator bool() const noexcept

  Checks if `*this` has an associated task object.

  Returns: `true` if `*this` is not empty, `false` otherwise.

## Non-Member Functions

    bool operator==(task_handle const& h, std::nullptr_t) noexcept
    bool operator==(std::nullptr_t, task_handle const& h) noexcept

Returns: `true` if `h` is empty, `false` otherwise.

    bool operator!=(task_handle const& h, std::nullptr_t) noexcept
    bool operator!=(std::nullptr_t, task_handle const& h) noexcept

Returns: `true` if `h` is not empty, `false` otherwise.