Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2471 Discussions

TBB concurrent_queue: forward declaration possible?

shachris23
New Contributor I
593 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
593 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.
0 Kudos
Reply