Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
2449 Discussions

TBB concurrent_queue: forward declaration possible?

shachris23
New Contributor I
217 Views
Hi,

Is it possible to forward declare TBB concurrent_queue?

I tried this:

namespace tbb { template< class T > class concurrent_queue; }

but that didnt work.

I want to forward declare it because I dont want my code user to have to #include TBB header file.
0 Kudos
1 Reply
ARCH_R_Intel
Employee
217 Views
Quoting - shachris23
Hi,

Is it possible to forward declare TBB concurrent_queue?

I tried this:

namespace tbb { template< class T > class concurrent_queue; }

but that didnt work.

I want to forward declare it because I dont want my code user to have to #include TBB header file.

It's namespace tbb { template class concurrent_queue; }. Even if you do have a forward declaration of it, the TBB header "tbb/concurrent_queue.h" must somehow be included, because template definitions have to be visible at compilation time. The ill-fated "export" keyword in C++98 was supposed to get around this, but I don't know how many vendors actually support it in their compilers.
Reply