Consider the following code:
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(0, &cpuset);
sched_setaffinity(0, sizeof(cpuset), &cpuset);
this sets the processor affinity of a process - the cores on which it is allowed to be scheduled basically. It uses the GNU C library facility (but I'm not sure it's supported on all OSes where glibc is supported). Now, I'm pretty certain the C++ standard library doesn't offer a similar facility, but - what is a common, more C++'ish idiom for doing the same thing?
There is no such functionality in the C++ standard library. Also, note that there is no such functionality in the C standard library either. It is provided by glibc, but not in its role as the C standard library: it's a part of Linux, not of the C standard.