Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2421 Discussions

TBB concurrent_queue: forward declaration possible?

shachris23
New Contributor I
162 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
162 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