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
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ endif()

project(iris VERSION 0.0.1 LANGUAGES CXX)

set(IRIS_ROOT "${CMAKE_CURRENT_LIST_DIR}")
if(DEFINED IRIS_ROOT AND NOT "${IRIS_ROOT}" PATH_EQUAL "${CMAKE_CURRENT_LIST_DIR}")
message(FATAL_ERROR "Cannot include Iris more than once")
endif()
set(CACHE{IRIS_ROOT} TYPE PATH VALUE "${CMAKE_CURRENT_LIST_DIR}")
set_property(GLOBAL PROPERTY IRIS_ROOT "${IRIS_ROOT}")
message(STATUS "IRIS_ROOT: ${IRIS_ROOT}")


# -----------------------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions cpp.hint
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// such as names of functions and macros.
// For more information see https://go.microsoft.com/fwlink/?linkid=865984

#define IRIS_RVARIANT_VISIT_NOEXCEPT

#define IRIS_RVARIANT_ALWAYS_THROWING_UNREACHABLE_BEGIN
#define IRIS_RVARIANT_ALWAYS_THROWING_UNREACHABLE_END

Expand All @@ -18,5 +16,5 @@
#define IRIS_FORCEINLINE
#define IRIS_LIFETIMEBOUND

#define IRIS_THROW_NORETURN [[noreturn]]
#define IRIS_CONFIG_THROW_NORETURN [[noreturn]]

4 changes: 2 additions & 2 deletions include/iris/alloy/adapt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct adaptor;

} // iris::alloy

#define IRIS_ALLOY_ADAPT_STRUCT_I(index, data_member, class_name) \
#define IRIS_ZZ_ALLOY_ADAPT_STRUCT_I(index, data_member, class_name) \
IRIS_PP_COMMA_IF(index) & class_name::data_member

#define IRIS_ALLOY_ADAPT_STRUCT(class_name, ...) \
Expand All @@ -28,7 +28,7 @@ struct adaptor;
using getters_list = iris::constant_list< \
IRIS_PP_SEQ_FOR_EACH_WITH_INDEX( \
IRIS_PP_TUPLE_TO_SEQ((__VA_ARGS__)), \
IRIS_ALLOY_ADAPT_STRUCT_I, \
IRIS_ZZ_ALLOY_ADAPT_STRUCT_I, \
class_name \
) \
>; \
Expand Down
2 changes: 1 addition & 1 deletion include/iris/alloy/adapted/std_pair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <utility> // IWYU pragma: export

#include <cstddef>
#include <cstddef> // IWYU pragma: keep

namespace iris::alloy {

Expand Down
2 changes: 1 addition & 1 deletion include/iris/alloy/traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct tuple_element {};
template<std::size_t I, class... Ts>
struct tuple_element<I, tuple<Ts...>>
{
using type = IRIS_CORE_PACK_INDEXING(I, Ts...);
using type = IRIS_PACK_INDEXING(I, Ts...);
};

template<std::size_t I, class... Ts>
Expand Down
4 changes: 2 additions & 2 deletions include/iris/alloy/tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct tuple_traits : tuple_traits_impl<std::index_sequence_for<Ts...>, UTuple,
template<class UTuple, class... Ts>
struct tuple_one_element_is_constructible_from_tuple
: std::bool_constant<(sizeof...(Ts) == 1) &&
(std::is_convertible_v<UTuple, IRIS_CORE_PACK_INDEXING(0, Ts...)> || std::is_constructible_v<IRIS_CORE_PACK_INDEXING(0, Ts...), UTuple>)>
(std::is_convertible_v<UTuple, IRIS_PACK_INDEXING(0, Ts...)> || std::is_constructible_v<IRIS_PACK_INDEXING(0, Ts...), UTuple>)>
{};

template<class UTuple, class... Ts>
Expand All @@ -67,7 +67,7 @@ class tuple : public detail::tuple_impl<Ts...>
template<class... Us>
static constexpr bool disambiguating_constraint = []() {
if constexpr (sizeof...(Ts) == 1) {
return !std::is_same_v<std::remove_cvref_t<IRIS_CORE_PACK_INDEXING(0, Us...)>, tuple>;
return !std::is_same_v<std::remove_cvref_t<IRIS_PACK_INDEXING(0, Us...)>, tuple>;
} else {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions include/iris/bits/is_function_object.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef IRIS_BITS_IS_FUNCTION_OBJECT
#define IRIS_BITS_IS_FUNCTION_OBJECT
#ifndef IRIS_ZZ_BITS_IS_FUNCTION_OBJECT_HPP
#define IRIS_ZZ_BITS_IS_FUNCTION_OBJECT_HPP

// SPDX-License-Identifier: MIT

Expand Down
4 changes: 2 additions & 2 deletions include/iris/bits/specialization_of.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef IRIS_BITS_SPECIALIZATION_OF
#define IRIS_BITS_SPECIALIZATION_OF
#ifndef IRIS_ZZ_BITS_SPECIALIZATION_OF_HPP
#define IRIS_ZZ_BITS_SPECIALIZATION_OF_HPP

// SPDX-License-Identifier: MIT

Expand Down
4 changes: 4 additions & 0 deletions include/iris/colorize_format.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef IRIS_ZZ_COLORIZE_FORMAT_HPP
#define IRIS_ZZ_COLORIZE_FORMAT_HPP

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <iris/string.hpp>
#include <iris/enum_bitops.hpp>
#include <iris/enum_bitops_algorithm.hpp>
Expand Down
4 changes: 3 additions & 1 deletion include/iris/cond_trivial_smf.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#ifndef IRIS_ZZ_COND_TRIVIAL_SMF_HPP
#ifndef IRIS_ZZ_COND_TRIVIAL_SMF_HPP
#define IRIS_ZZ_COND_TRIVIAL_SMF_HPP

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <type_traits>

namespace iris {
Expand Down
4 changes: 3 additions & 1 deletion include/iris/default_init_allocator.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#ifndef IRIS_ZZ_DEFAULT_INIT_ALLOCATOR_HPP
#ifndef IRIS_ZZ_DEFAULT_INIT_ALLOCATOR_HPP
#define IRIS_ZZ_DEFAULT_INIT_ALLOCATOR_HPP

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <memory>
#include <new>
#include <type_traits>
Expand Down
2 changes: 2 additions & 0 deletions include/iris/enum_bitops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <concepts>
#include <type_traits>
#include <utility>
Expand Down
2 changes: 2 additions & 0 deletions include/iris/enum_bitops_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <iris/enum_bitops.hpp>

#include <limits>
Expand Down
2 changes: 2 additions & 0 deletions include/iris/enum_bitops_io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <iris/string.hpp>
#include <iris/enum_bitops.hpp>

Expand Down
30 changes: 16 additions & 14 deletions include/iris/exception.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef IRIS_ZZ_EXCEPTION_HPP
#define IRIS_ZZ_EXCEPTION_HPP

#include <iris/config.hpp> // IWYU pragma: keep

#include <iris/string.hpp>

#include <exception>
Expand All @@ -11,12 +13,12 @@
#include <type_traits>
#include <utility>

#ifndef IRIS_THROW_IMPL
# define IRIS_THROW_IMPL(...) throw __VA_ARGS__
#ifndef IRIS_CONFIG_THROW_IMPL
# define IRIS_CONFIG_THROW_IMPL(...) throw __VA_ARGS__
#endif

#ifndef IRIS_THROW_NORETURN
# define IRIS_THROW_NORETURN [[noreturn]]
#ifndef IRIS_CONFIG_THROW_NORETURN
# define IRIS_CONFIG_THROW_NORETURN [[noreturn]]
#endif

namespace iris {
Expand All @@ -34,44 +36,44 @@ concept constructible_from_string_like_types =
inline namespace error_functions {

template<class E>
IRIS_THROW_NORETURN void throwf()
IRIS_CONFIG_THROW_NORETURN void throwf()
{
static_assert(std::is_base_of_v<std::exception, E>);
static_assert(std::is_constructible_v<E>);
IRIS_THROW_IMPL(E{});
IRIS_CONFIG_THROW_IMPL(E{});
}

template<class E, class Arg, class... Rest>
requires std::is_constructible_v<E, Arg, Rest...>
IRIS_THROW_NORETURN void throwf(Arg&& arg, Rest&&... rest)
IRIS_CONFIG_THROW_NORETURN void throwf(Arg&& arg, Rest&&... rest)
{
static_assert(std::is_base_of_v<std::exception, E>);
static_assert(!std::is_base_of_v<std::exception, std::remove_cvref_t<Arg>>, "don't copy/move construct exception types directly");
IRIS_THROW_IMPL(E{std::forward<Arg>(arg), std::forward<Rest>(rest)...});
IRIS_CONFIG_THROW_IMPL(E{std::forward<Arg>(arg), std::forward<Rest>(rest)...});
}

template<class E, class... Args>
requires detail::constructible_from_string_like_types<E>
IRIS_THROW_NORETURN void throwf(std::format_string<Args...> fmt, Args&&... args)
IRIS_CONFIG_THROW_NORETURN void throwf(std::format_string<Args...> fmt, Args&&... args)
{
static_assert(std::is_base_of_v<std::exception, E>);
IRIS_THROW_IMPL(E{std::format(std::move(fmt), std::forward<Args>(args)...)});
IRIS_CONFIG_THROW_IMPL(E{std::format(std::move(fmt), std::forward<Args>(args)...)});
}

template<class E, NotStringLike Arg0, class... Args>
requires detail::constructible_from_string_like_types<E, Arg0>
IRIS_THROW_NORETURN void throwf(Arg0&& arg0, std::format_string<Args...> fmt, Args&&... args)
IRIS_CONFIG_THROW_NORETURN void throwf(Arg0&& arg0, std::format_string<Args...> fmt, Args&&... args)
{
static_assert(std::is_base_of_v<std::exception, E>);
IRIS_THROW_IMPL(E{std::forward<Arg0>(arg0), std::format(std::move(fmt), std::forward<Args>(args)...)});
IRIS_CONFIG_THROW_IMPL(E{std::forward<Arg0>(arg0), std::format(std::move(fmt), std::forward<Args>(args)...)});
}

template<class E, NotStringLike Arg0, NotStringLike Arg1, class... Args>
requires detail::constructible_from_string_like_types<E, Arg0, Arg1>
IRIS_THROW_NORETURN void throwf(Arg0&& arg0, Arg1&& arg1, std::format_string<Args...> fmt, Args&&... args)
IRIS_CONFIG_THROW_NORETURN void throwf(Arg0&& arg0, Arg1&& arg1, std::format_string<Args...> fmt, Args&&... args)
{
static_assert(std::is_base_of_v<std::exception, E>);
IRIS_THROW_IMPL(
IRIS_CONFIG_THROW_IMPL(
E{
std::forward<Arg0>(arg0), std::forward<Arg1>(arg1),
std::format(std::move(fmt), std::forward<Args>(args)...)
Expand Down
2 changes: 2 additions & 0 deletions include/iris/fixed_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <algorithm>
#include <array>
#include <string>
Expand Down
2 changes: 2 additions & 0 deletions include/iris/format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <iris/format_traits.hpp>

#include <format>
Expand Down
3 changes: 2 additions & 1 deletion include/iris/format_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <format>
#include <type_traits>


namespace iris {

template<class charT>
Expand Down
2 changes: 2 additions & 0 deletions include/iris/hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <iris/requirements.hpp>
#include <iris/type_traits.hpp>

Expand Down
4 changes: 3 additions & 1 deletion include/iris/hash/FNV_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <bit>
#include <memory>

#include <cstddef>
#include <cstddef> // IWYU pragma: keep

// https://datatracker.ietf.org/doc/html/draft-eastlake-fnv-03#section-2
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59406
Expand Down
2 changes: 2 additions & 0 deletions include/iris/hash_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <version>

#if !defined(_MSC_VER) && __cplusplus <= 202302L || \
Expand Down
2 changes: 2 additions & 0 deletions include/iris/indirect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <iris/bits/specialization_of.hpp>
#include <iris/compare.hpp>
#include <iris/hash.hpp>
Expand Down
5 changes: 3 additions & 2 deletions include/iris/indirect_pmr.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#ifndef IRIS_ZZ_INDIRECT_PMR_HPP
#ifndef IRIS_ZZ_INDIRECT_PMR_HPP
#define IRIS_ZZ_INDIRECT_PMR_HPP

// SPDX-License-Identifier: MIT

#include <iris/config.hpp> // IWYU pragma: keep

#include <iris/indirect.hpp>

#include <memory_resource>


namespace iris::pmr {

template<class T>
Expand Down
3 changes: 2 additions & 1 deletion include/iris/interval.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp>
#include <iris/config.hpp> // IWYU pragma: keep

#include <iris/format_traits.hpp>
#include <iris/string.hpp>

Expand Down
6 changes: 3 additions & 3 deletions include/iris/interval_algo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp>
#include <iris/interval.hpp>
#include <iris/config.hpp> // IWYU pragma: keep
#include <iris/interval.hpp> // IWYU pragma: export

#include <concepts>
#include <type_traits>
Expand All @@ -15,7 +15,7 @@
#include <map>
#include <set>

#include <cstddef>
#include <cstddef> // IWYU pragma: keep

namespace iris {

Expand Down
4 changes: 2 additions & 2 deletions include/iris/interval_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp>
#include <iris/config.hpp> // IWYU pragma: keep
#include <iris/iterator.hpp>

#include <format>
Expand All @@ -14,7 +14,7 @@
#include <utility>
#include <compare>

#include <cstddef>
#include <cstddef> // IWYU pragma: keep

namespace iris {

Expand Down
2 changes: 1 addition & 1 deletion include/iris/iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// SPDX-License-Identifier: MIT

#include <iris/config.hpp>
#include <iris/config.hpp> // IWYU pragma: keep

#include <iterator>
#include <compare>
Expand Down
1 change: 0 additions & 1 deletion include/iris/ngram/detail/id_store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <iris/exception.hpp>

#include <vector>
#include <utility>

#include <cassert>

Expand Down
Loading
Loading