Skip to content
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
matrix:
os:
- name: ubuntu
version: 24.04
version: 26.04
- name: windows
version: 2025-vs2026
build_type:
Expand All @@ -62,13 +62,13 @@ jobs:
compiler:
- name: GCC
toolset: gcc
version: 14
executable: g++-14
version: 15
executable: g++-15
cxxflags: -fdiagnostics-color=always
- name: Clang
toolset: clang
version: 21
executable: clang++-21
version: 22
executable: clang++-22
cxxflags: -stdlib=libc++ -fcolor-diagnostics
- name: MSVC
toolset: msvc
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# iris
Iris is a modern C++ library collection that provides a starting point for building various applications and libraries.

### Supported Environments

- C++23 and C++26
- GCC 15
- Clang 22
- MSVC 2026
29 changes: 18 additions & 11 deletions include/iris/colorize_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
# define IRIS_COLORIZE_HAS_STATIC 0
#endif

// should be __cpp_lib_format >= 202603L
// TODO: since 202603L, `runtime_format` has been renamed to
// `dynamic_format`; our codebase needs renaming too. However
// we lack decent compilers right now; making it practically
// untestable.
#define IRIS_HAS_DYNAMIC_FORMAT 0

namespace iris {

class colorize_error : public std::invalid_argument
Expand Down Expand Up @@ -905,7 +912,7 @@ struct basic_dynamic_colorized_string

using dynamic_colorized_string = basic_dynamic_colorized_string<char>;

#if __cpp_lib_format >= 202311L
#if IRIS_HAS_DYNAMIC_FORMAT

template<class CharT>
struct basic_dynamic_colorized_format_string
Expand Down Expand Up @@ -956,8 +963,8 @@ struct basic_colorized_format_string
scanner.scan();
}

#if __cpp_lib_format >= 202311L
explicit constexpr basic_colorize_format_string(detail::basic_dynamic_colorized_format_string<CharT> dynamic_str)
#if IRIS_HAS_DYNAMIC_FORMAT
explicit constexpr basic_colorized_format_string(detail::basic_dynamic_colorized_format_string<CharT> dynamic_str)
: fmt_(std::runtime_format(dynamic_str.str_))
{
}
Expand Down Expand Up @@ -1018,13 +1025,13 @@ dynamic_colorize(std::string_view str)
return detail::basic_dynamic_colorized_string{str};
}

#if __cpp_lib_format >= 202311L
#if IRIS_HAS_DYNAMIC_FORMAT

template<int = 0>
[[nodiscard]] constexpr detail::dynamic_colorize_format_string
[[nodiscard]] constexpr detail::dynamic_colorized_format_string
dynamic_colorize_format(std::string_view str)
{
return detail::basic_dynamic_colorize_format_string{str};
return detail::basic_dynamic_colorized_format_string{str};
}

#endif
Expand Down Expand Up @@ -1099,7 +1106,7 @@ constexpr Out colorize_format_to(Out out, static_colorized_string<Str>, Args&&..
template<class... Args>
[[nodiscard]] constexpr std::string colorize_format(colorized_string_view str, Args&&... args)
{
#if __cpp_lib_format >= 202311L
#if IRIS_HAS_DYNAMIC_FORMAT
return std::format(std::runtime_format(ansi_colorize::colorize(str)), std::make_format_args(args...));
#else
return std::vformat(ansi_colorize::colorize(str), std::make_format_args(args...));
Expand All @@ -1109,7 +1116,7 @@ template<class... Args>
template<class... Args>
[[nodiscard]] constexpr std::string colorize_format(colorize_config const& cfg, std::string_view str, Args&&... args)
{
#if __cpp_lib_format >= 202311L
#if IRIS_HAS_DYNAMIC_FORMAT
return std::format(std::runtime_format(ansi_colorize::colorize(colorized_string_view{str, &cfg}, &cfg)), std::make_format_args(args...));
#else
return std::vformat(ansi_colorize::colorize(colorized_string_view{str, &cfg}, &cfg), std::make_format_args(args...));
Expand All @@ -1121,7 +1128,7 @@ template<class... Args>
template<std::output_iterator<char const&> Out, class... Args>
constexpr Out colorize_format_to(Out out, colorized_string_view str, Args&&... args)
{
#if __cpp_lib_format >= 202311L
#if IRIS_HAS_DYNAMIC_FORMAT
return std::format_to(std::move(out), std::runtime_format(ansi_colorize::colorize(str)), args...);
#else
return std::vformat_to(std::move(out), ansi_colorize::colorize(str), std::make_format_args(args...));
Expand All @@ -1131,7 +1138,7 @@ constexpr Out colorize_format_to(Out out, colorized_string_view str, Args&&... a
template<std::output_iterator<char const&> Out, class... Args>
constexpr Out colorize_format_to(Out out, colorize_config const& cfg, std::string_view str, Args&&... args)
{
#if __cpp_lib_format >= 202311L
#if IRIS_HAS_DYNAMIC_FORMAT
return std::format_to(std::move(out), std::runtime_format(ansi_colorize::colorize(colorized_string_view{str, &cfg}, &cfg)), args...);
#else
return std::vformat_to(std::move(out), ansi_colorize::colorize(colorized_string_view{str, &cfg}, &cfg), std::make_format_args(args...));
Expand Down Expand Up @@ -1166,7 +1173,7 @@ using ansi_colorize::static_colorized_string;

using ansi_colorize::dynamic_colorize;

#if __cpp_lib_format >= 202311L
#if IRIS_HAS_DYNAMIC_FORMAT
using ansi_colorize::dynamic_colorize_format;
#endif

Expand Down
4 changes: 3 additions & 1 deletion include/iris/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ struct at_c;
template<std::size_t I, class T>
using at_c_t = at_c<I, T>::type;

#if __cpp_pack_indexing >= 202311L // has native pack indexing
// Has native pack indexing?
// Note: GCC 15 emits "sorry, unimplemented: mangling type pack index"
#if !(defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 15) && __cpp_pack_indexing >= 202311L

# define IRIS_CORE_PACK_INDEXING(I, Ts_ellipsis) Ts_ellipsis[I]

Expand Down
9 changes: 7 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,25 @@ endif()
set(CATCH_CONFIG_FAST_COMPILE ON)
set(CATCH_CONFIG_NO_USE_BUILTIN_CONSTANT_P ON)
set(CATCH_CONFIG_DISABLE_EXCEPTIONS ON) # disable default `catch(...)` to enable debugger
set(CATCH_CONFIG_COUNTER OFF)

include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2
GIT_TAG v3.12.0
GIT_TAG v3.15.3
GIT_SHALLOW ON
)
FetchContent_MakeAvailable(Catch2)

set_target_properties(Catch2 PROPERTIES CXX_EXTENSIONS OFF)
set_target_properties(Catch2 Catch2WithMain PROPERTIES FOLDER "_deps")

target_compile_definitions(Catch2 PUBLIC DO_NOT_USE_WMAIN)
target_compile_definitions(
Catch2 PUBLIC
DO_NOT_USE_WMAIN
CATCH_CONFIG_NO_COUNTER=1
)

if(MSVC)
target_compile_options(Catch2 PRIVATE /wd6054)
Expand Down
Loading