https://github.com/mpadge/settest
https://github.com/mpadge/settest
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mpadge/settest
- Owner: mpadge
- Created: 2023-06-02T09:25:19.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-02T09:51:43.000Z (almost 2 years ago)
- Last Synced: 2025-02-14T13:23:52.886Z (3 months ago)
- Language: C++
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Test R package compilation with >= C++17
CRAN is now completely C++11 compliant, so demands removal of all `CXX_STD`
statements for C++11. This then leaves the standard dependent on the local
system. This repo demonstrates one issue when local systems are >= C++17, which
fail to compile with use of `std::set`. The typical compile error looks
something like this:
```
test.cpp:7:21: required from here
/usr/include/c++/11/bits/stl_tree.h:770:15: error: static assertion failed: comparison object must be invocable as const
770 | is_invocable_v,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/stl_tree.h:770:15: note: ‘std::is_invocable_v’ evaluates to false
make: *** [/opt/R/4.3.0/lib/R/etc/Makeconf:200: test.o] Error 1
ERROR: compilation failed for package ‘settest’
```The solution requires explicitly specifying the set comparison operator as `const`, so changing from
``` cpp
bool operator () (const TestStruct& lhs, const TestStruct& rhs) { ... }
```
to
``` cpp
bool operator () (const TestStruct& lhs, const TestStruct& rhs) const { ... }
```