https://github.com/flagarde/source_location
cross-platform source_location for c++98 to c++20
https://github.com/flagarde/source_location
clang cmake cpp11 cpp17 cpp20 cpp98 gcc include-only msvc msys2 source-location
Last synced: 2 months ago
JSON representation
cross-platform source_location for c++98 to c++20
- Host: GitHub
- URL: https://github.com/flagarde/source_location
- Owner: flagarde
- License: mit
- Created: 2021-05-22T17:29:00.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-20T13:56:17.000Z (about 1 year ago)
- Last Synced: 2025-04-10T00:50:56.043Z (2 months ago)
- Topics: clang, cmake, cpp11, cpp17, cpp20, cpp98, gcc, include-only, msvc, msys2, source-location
- Language: CMake
- Homepage: https://flagarde.github.io/source_location
- Size: 194 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# source_location
cross-platform pre c++20 `source_location`It uses :
```cpp
#include
```
or
``` cpp
#include
```
if they are available.[LC]: https://github.com/flagarde/source_location/actions/workflows/Linux-Clang.yml
[LCB]: https://github.com/flagarde/source_location/actions/workflows/Linux-Clang.yml/badge.svg[LG]: https://github.com/flagarde/source_location/actions/workflows/Linux-GCC.yml
[LGB]: https://github.com/flagarde/source_location/actions/workflows/Linux-GCC.yml/badge.svg[MC]: https://github.com/flagarde/source_location/actions/workflows/MacOS-Clang.yml
[MCB]: https://github.com/flagarde/source_location/actions/workflows/MacOS-Clang.yml/badge.svg[MG]: https://github.com/flagarde/source_location/actions/workflows/MacOS-GCC.yml
[MGB]: https://github.com/flagarde/source_location/actions/workflows/MacOS-GCC.yml/badge.svg[MS]: https://github.com/flagarde/source_location/actions/workflows/Windows-MSYS2.yml
[MSB]: https://github.com/flagarde/source_location/actions/workflows/Windows-MSYS2.yml/badge.svg[MM]: https://github.com/flagarde/source_location/actions/workflows/Windows-MSVC.yml
[MMB]: https://github.com/flagarde/source_location/actions/workflows/Windows-MSVC.yml/badge.svg## Builds
| | Linux Clang | Linux GCC | MacOS Clang | MacOS GCC | Windows M2sys | Windows MSVC |
|--------|-------------|-----------|-------------|-----------|---------------|--------------|
| Github |[![Linux Clang][LCB]][LC]|[![Linux GCC][LGB]][LG]|[![MacOS Clang][MCB]][MC]|[![MacOS GCC][MGB]][MG]|[![Windows MSYS2][MSB]][MS]|[![Windows MSVC][MMB]][MM]|## Example
```cpp
#include
#includeint main()
{
source_location loc(source_location::current());
std::cout << loc.file_name() << std::endl;
std::cout << loc.function_name() << std::endl;
std::cout << loc.line() << std::endl;
}
```
## Tests
* On `Linux` :
* `gcc-9` : `c++98`, `c++11`, `c++17`, `c++20`
* `gcc-10` : `c++98`, `c++11`, `c++17`, `c++20`
* `clang-10` : `c++98`, `c++11`, `c++17`, `c++20`
* `clang-11` : `c++98`, `c++11`, `c++17`, `c++20`
* On `MacOS` :
* `gcc-9` : `c++98`, `c++11`, `c++17`, `c++20`
* `gcc-10` : `c++98`, `c++11`, `c++17`, `c++20`
* `gcc-11` : `c++98`, `c++11`, `c++17`, `c++20`
* `clang-12` : `c++98`, `c++11`, `c++17`, `c++20`
* On `Windows` :
* `MSVC 19.28.29915.0` : `c++98`, `c++11`, `c++17`, `c++20`
* `MSYS2 GNU 10.2.0` : `c++98`, `c++11`, `c++17`, `c++20`
* `MSYS2 Clang 12.0.0` : `c++98`, `c++11`, `c++17`, `c++20`