Looking at the C++11 standard. I can see that specialization of std::tuple_size
and std::tuple_element
are provided for volatile
and const volatile
tuple.
template <size_t I, class T> class tuple_element<I, volatile T>;
template <size_t I, class T> class tuple_element<I, const volatile T>;
template <class T> class tuple_size<volatile T>;
template <class T> class tuple_size<const volatile T>;
But std::get
do no offer specialization for volatile
or const volatile
tuple.
I tried the following code on GCC.4.8.1
volatile std::tuple<int, int> a(1, 1);
std::cout << "a<0>=" << std::get<0>(a) << "\n";
I get error: no matching function for call to 'get(volatile std::tuple<int, int>&)'
So if I understand I can create (const) volatile tuples but I can not access their elements.
Is this an expected behavior or an oversight ?
Thanks very much.