Move SwigValueWrapper to header section

Recent change to SwigValueWrapper required the <utility> header.
Included headers should be after the include of the language
specific header files (which go into the earlier runtime section).

Testcase required -Winit-list-lifetime warning suppression change
for Perl which somehow lost the warning suppression when put
into the %begin section.
This commit is contained in:
William S Fulton 2022-09-09 07:49:48 +01:00
commit 0c2d0fea0f
2 changed files with 5 additions and 6 deletions

View file

@ -665,7 +665,9 @@ namespace std {
*/
#ifdef __cplusplus
%insert("runtime") %{
// Placed in the header section to ensure the language specific header files are
// the first included headers and not <utility>
%insert("header") %{
#ifdef __cplusplus
#include <utility>
/* SwigValueWrapper is described in swig.swg */
@ -688,7 +690,7 @@ public:
operator T&() const { return *pointer.ptr; }
#endif
T *operator&() const { return pointer.ptr; }
};%}
};
/*
* SwigValueInit() is a generic initialisation solution as the following approach:
@ -699,13 +701,10 @@ public:
*
* unsigned int c_result = unsigned int();
*/
%insert("runtime") %{
template <typename T> T SwigValueInit() {
return T();
}
%}
%insert("runtime") %{
#if __cplusplus >=201103L
# define SWIG_STD_MOVE(OBJ) std::move(OBJ)
#else