The C++ standard does not allow you to set a thread's affinity. You will have to use boost or your system's API for that.
NOTE: While explicit affinity management can result in great rewards, it also bears risk. It might result in disabling of some optimizations implemented by the system's own scheduler, which is especially bad when the processes you control with this method are not the heaviest in your system. Also, affinity management can quickly go wrong: Imagine you accidentally load 90% of your load onto just one or two cores on your (today's common) octa-core system. Affinity management will eventually need an AI to work well in the ever-more complex systems we are facing, but simple rule-based management can work well if you can accurately predict the process work load.
EDIT: In order to prevent your OS from scheduling anything else on that core, you will need another OS function. As mentioned in the comments, isolcpus lets you achieve that on Linux.