Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bump required C++ standard to c++17 #27012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/api/next_api_changes/development/27012-ES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extensions require C++17
~~~~~~~~~~~~~~~~~~~~~~~~

Matplotlib now requires a compiler that supports C++17 in order to build its extensions.
According to `SciPy's analysis
<https://docs.scipy.org/doc/scipy/dev/toolchain.html#c-language-standards>`_, this
should be available on all supported platforms.
14 changes: 7 additions & 7 deletions doc/devel/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ in your target environment manually:
C++ compiler
------------

Matplotlib requires a C++ compiler that supports C++11, and each platform has a
Matplotlib requires a C++ compiler that supports C++17, and each platform has a
development environment that must be installed before a compiler can be installed.

.. tab-set::
Expand Down Expand Up @@ -277,18 +277,18 @@ Xcode, VS Code or Linux package manager. Choose **one** compiler from this list:
- platforms
- notes
* - GCC
- **4.8.1**
- **7.2**
- Linux, macOS, Windows
- `gcc 4.8.1 <https://gcc.gnu.org/projects/cxx-status.html#cxx11>`_,
- `gcc 7.2 <https://gcc.gnu.org/projects/cxx-status.html#cxx17>`_,
`GCC: Binaries <https://gcc.gnu.org/install/binaries.html>`_,
* - Clang (LLVM)
- **3.3**
- **5**
- Linux, macOS
- `clang 3.3 <https://clang.llvm.org/cxx_status.html>`_, `LLVM <https://releases.llvm.org/download.html>`_
- `clang 5 <https://clang.llvm.org/cxx_status.html>`_, `LLVM <https://releases.llvm.org/download.html>`_
* - MSVC++
- **14.0**
- **16.0**
- Windows
- `Visual Studio 2015 C++ <https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=msvc-140>`_
- `Visual Studio 2019 C++ <https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=msvc-160>`_



Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project(
meson_version: '>=1.1.0',
default_options: [
'b_lto=true',
'cpp_std=c++11',
'cpp_std=c++17',
'auto_features=disabled', # Force FreeType to avoid extra dependencies.
],
)
Expand Down
51 changes: 25 additions & 26 deletions src/_image_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,40 @@
* */

const char* image_resample__doc__ =
"Resample input_array, blending it in-place into output_array, using an\n"
"affine transformation.\n\n"
R"""(Resample input_array, blending it in-place into output_array, using an affine transform.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extraneous paren

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is C++11 raw string literal syntax; it's R"<something>(...)<something>" where <something> is an optional string to prevent ambiguity if your string might contain )". I chose additional double quotes to make it look similar to a Python multiline string, but if that is confusing a different string could be chosen.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Yes, it is! Actually, let's keep it this way. I just haven't encountered it enough to recognize it for what it was.


"Parameters\n"
"----------\n"
"input_array : 2-d or 3-d NumPy array of float, double or `numpy.uint8`\n"
" If 2-d, the image is grayscale. If 3-d, the image must be of size\n"
" 4 in the last dimension and represents RGBA data.\n\n"
Parameters
----------
input_array : 2-d or 3-d NumPy array of float, double or `numpy.uint8`
If 2-d, the image is grayscale. If 3-d, the image must be of size 4 in the last
dimension and represents RGBA data.

"output_array : 2-d or 3-d NumPy array of float, double or `numpy.uint8`\n"
" The dtype and number of dimensions must match `input_array`.\n\n"
output_array : 2-d or 3-d NumPy array of float, double or `numpy.uint8`
The dtype and number of dimensions must match `input_array`.

"transform : matplotlib.transforms.Transform instance\n"
" The transformation from the input array to the output array.\n\n"
transform : matplotlib.transforms.Transform instance
The transformation from the input array to the output array.

"interpolation : int, default: NEAREST\n"
" The interpolation method. Must be one of the following constants\n"
" defined in this module:\n\n"
interpolation : int, default: NEAREST
The interpolation method. Must be one of the following constants defined in this
module:

" NEAREST, BILINEAR, BICUBIC, SPLINE16, SPLINE36,\n"
" HANNING, HAMMING, HERMITE, KAISER, QUADRIC, CATROM, GAUSSIAN,\n"
" BESSEL, MITCHELL, SINC, LANCZOS, BLACKMAN\n\n"
NEAREST, BILINEAR, BICUBIC, SPLINE16, SPLINE36, HANNING, HAMMING, HERMITE, KAISER,
QUADRIC, CATROM, GAUSSIAN, BESSEL, MITCHELL, SINC, LANCZOS, BLACKMAN

"resample : bool, optional\n"
" When `True`, use a full resampling method. When `False`, only\n"
" resample when the output image is larger than the input image.\n\n"
resample : bool, optional
When `True`, use a full resampling method. When `False`, only resample when the
output image is larger than the input image.

"alpha : float, default: 1\n"
" The transparency level, from 0 (transparent) to 1 (opaque).\n\n"
alpha : float, default: 1
The transparency level, from 0 (transparent) to 1 (opaque).

"norm : bool, default: False\n"
" Whether to norm the interpolation function.\n\n"
norm : bool, default: False
Whether to norm the interpolation function.

"radius: float, default: 1\n"
" The radius of the kernel, if method is SINC, LANCZOS or BLACKMAN.\n";
radius: float, default: 1
The radius of the kernel, if method is SINC, LANCZOS or BLACKMAN.
)""";


static pybind11::array_t<double>
Expand Down