In the C++ Standard Library, `std::integral_constant`
has its `operator T` marked as `noexcept`:
https://timsong-cpp.github.io/cppwp/meta.help
We hereby do the same for the Boost version.
If the compiler does not optimize away the `pdata` function-local `static` object,
it ends up occupying space in the data section
and it is going to need a corresponding relocation entry
(just in case the module is not loaded at the desired address,
as is the case with ASLR in Windows Vista and later and in modern versions of Linux).
I admit that, for the current code,
both MSVC and GCC manage to optimize away `pdata` even if it is `static`.
But Boost should be an example of good coding
which can be applied even to more complicated source code,
e.g. to source code which calls `opaque_function (&pdata)`
(in which case, if `pdata` is static, both MSVC and GCC do emit an extra relocation).
And for other more complex cases, a function-local static-storage-duration object
costs even more (as compared to a function-local automatic-storage-duration object
given C++11 rules for "thread-safe" initialization of function-local `static`s.
And I wish to re-iterate that, in my opinion,
a good way to cast a pointer-to-one-type to a pointer-to-an-unrelated-type
is not by `reinterpret_cast` (which by the way makes `pdata` not needed any more),
but by using pointer to (possibly cv-qualified) `void` as an intermediary pointer type:
```
return static_cast <const Target *> (static_cast <const void *> (pointer_to_source))
```
or:
```
const void *const intermediary (pointer_to_source); // Not `static` for the general case.
return static_cast <const Target *> (intermediary);
```
Therefore, if the authors kindly agree, we can make this code an example for this style.
Conversion between pointers to unrelated types `Source` and `Target`
can be done with two `static_cast`'s
("upcast" to pointer to cv-void followed by "downcast")
=> (IMO) it should be done with `static_cast`
(in order not to give the impression that `reinterpret_cast` really is needed):
`T *ptr_target = static_cast <T *> (static_cast <void *> (ptr_source));`
(Maybe that was the original intent of introducing `pdata`.)
Also modified the implementation to avoid referencing any potential swap
overloads in namespace boost, unless these overloads are found by ADL.
Added tests to verify is_nothrow_swappable works with ADL.
Use `#ifdef __cpp_noexcept_function_type` instead of
`#if __cpp_noexcept_function_type` to avoid `-Wundef` warnings.
Also add that flag to the test flags to detect those on CI.
../../boost/type_traits/is_complete.hpp:47:14: error: conversion from ‘long unsigned int’ to ‘unsigned int’ may change value
ok_tag<sizeof(T)> check_is_complete(int);