Files
Kevin Newton 957a081892 [ruby/prism] Ship an official C++ interface
The C++ interface is intentionally minimal: it provides only a
couple of niceties in order to largely stay out of the way. It is
mostly used to provide:

* RAII for opaque resources
* Safe up and down casting for nodes
* string_view for various resources
* Iteration over resource lists

Note that if consumers want to use it, they must be on C++17 at
minimum.

https://github.com/ruby/prism/commit/57b8dbe0e9
2026-10-20 22:15:29 +00:00

17 lines
540 B
C++

/**
* @file compiler/cplusplus.hpp
*/
#ifndef PRISM_COMPILER_CPLUSPLUS_HPP
#define PRISM_COMPILER_CPLUSPLUS_HPP
/**
* The C++ interface relies on C++17 for inline variables, std::string_view,
* std::void_t, and std::is_invocable_r_v. MSVC reports __cplusplus as 199711L
* unless /Zc:__cplusplus is passed, so its own _MSVC_LANG is checked as well.
*/
#if !defined(__cplusplus) || ((__cplusplus < 201703L) && (!defined(_MSVC_LANG) || (_MSVC_LANG < 201703L)))
# error "the prism C++ interface requires C++17 or later"
#endif
#endif