Skip to content

Commit

Permalink
I hate C++ versioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed Apr 3, 2020
1 parent 4081576 commit 234a561
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 99 deletions.
2 changes: 1 addition & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ file(GLOB_RECURSE itsy.bitsy.benchmarks.sources CONFIGURE_DEPENDS source/**)
add_executable(itsy.bitsy.benchmarks ${itsy.bitsy.benchmarks.sources})
target_include_directories(itsy.bitsy.benchmarks PRIVATE
include
../vendor/range-v3/include
../vendor/span-lite/include
)
target_link_libraries(itsy.bitsy.benchmarks PRIVATE
itsy::bitsy
Expand Down
172 changes: 86 additions & 86 deletions benchmarks/results/fresh/sources.json
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
{
"name": "bit",
"scale": {
"type": "relative",
"to": "base"
},
"categories": [
{
"name": "find",
"prefix": "find_",
"suffix": ""
},
{
"name": "count",
"prefix": "count_",
"suffix": ""
},
{
"name": "fill",
"prefix": "fill_",
"suffix": ""
},
{
"name": "copy",
"prefix": "copy_",
"suffix": ""
},
{
"name": "copy_n",
"prefix": "sized_copy_",
"suffix": ""
},
{
"name": "swap_ranges",
"prefix": "swap_ranges_",
"suffix": ""
},
{
"name": "rotate",
"prefix": "rotate_",
"suffix": ""
},
{
"name": "equal",
"prefix": "equal_",
"suffix": ""
}
],
"data_labels": [
{
"ascending": true,
"name": "real_time",
"format": "clock"
},
{
"ascending": true,
"name": "cpu_time",
"format": "clock"
}
],
"remove_suffixes": [
",",
"_"
],
"remove_prefixes": [
",",
"_"
],
"sources": [
{
"prefix": "libc++",
"file": "libc++.itsy.bitsy.benchmarks.json",
"required": false
},
{
"prefix": "libstdc++",
"file": "libstdc++.itsy.bitsy.benchmarks.json",
"required": false
},
{
"prefix": "vc++",
"file": "vc++.itsy.bitsy.benchmarks.json",
"required": false
}
]
}
{
"name": "bit",
"scale": {
"type": "relative",
"to": "base"
},
"categories": [
{
"name": "find",
"prefix": "find_",
"suffix": ""
},
{
"name": "count",
"prefix": "count_",
"suffix": ""
},
{
"name": "fill",
"prefix": "fill_",
"suffix": ""
},
{
"name": "copy",
"prefix": "copy_",
"suffix": ""
},
{
"name": "copy_n",
"prefix": "sized_copy_",
"suffix": ""
},
{
"name": "swap_ranges",
"prefix": "swap_ranges_",
"suffix": ""
},
{
"name": "rotate",
"prefix": "rotate_",
"suffix": ""
},
{
"name": "equal",
"prefix": "equal_",
"suffix": ""
}
],
"data_labels": [
{
"ascending": true,
"name": "real_time",
"format": "clock"
},
{
"ascending": true,
"name": "cpu_time",
"format": "clock"
}
],
"remove_suffixes": [
",",
"_"
],
"remove_prefixes": [
",",
"_"
],
"sources": [
{
"prefix": "libc++",
"file": "libc++.itsy.bitsy.benchmarks.json",
"required": false
},
{
"prefix": "libstdc++",
"file": "libstdc++.itsy.bitsy.benchmarks.json",
"required": false
},
{
"prefix": "vc++",
"file": "vc++.itsy.bitsy.benchmarks.json",
"required": false
}
]
}
2 changes: 1 addition & 1 deletion examples/include/span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <itsy/bitsy.hpp>

#if (defined(__has_include) && __has_include(<version>)) || (__cplusplus > 201709L)
#if (defined(__has_include) && __has_include(<version>))
#include <version>
#endif

Expand Down
3 changes: 2 additions & 1 deletion include/itsy/detail/bit_operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
#ifndef ITSY_BITSY_DETAIL_BIT_OPERATIONS_HPP
#define ITSY_BITSY_DETAIL_BIT_OPERATIONS_HPP 1

#include <itsy/version.hpp>

#include <itsy/detail/bit_detail.hpp>

#include <climits>
#include <version>
#if defined(__cpp_lib_bitops)
#include <bit>
#endif // C++20 Bit Operations
Expand Down
16 changes: 6 additions & 10 deletions include/itsy/detail/span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

#include <itsy/version.hpp>

#if (defined(__has_include) && __has_include(<version>)) || (__cplusplus > 201709L)
#include <version>
#endif

#if defined(__cpp_lib_span)

#include <span>
Expand All @@ -28,22 +24,22 @@ namespace ITSY_BITSY_DETAIL_NAMESPACE
using ::std::span;
}

#elif defined(__has_include) && __has_include(<range/v3/view/span.hpp>)
#elif (defined(__has_include) && __has_include(<nonstd/span.hpp>)) || (defined(ITSY_BITSY_USE_NONSTD_SPAN) && ITSY_BITSY_USE_NONSTD_SPAN != 0)

#include <range/v3/view/span.hpp>
#include <nonstd/span.hpp>

namespace ITSY_BITSY_DETAIL_NAMESPACE
{
using ::ranges::span;
using ::nonstd::span;
}

#elif (defined(__has_include) && __has_include(<nonstd/span.hpp>)) || (defined(ITSY_BITSY_USE_NONSTD_SPAN) && ITSY_BITSY_USE_NONSTD_SPAN != 0)
#elif defined(__has_include) && __has_include(<range/v3/view/span.hpp>)

#include <nonstd/span.hpp>
#include <range/v3/view/span.hpp>

namespace ITSY_BITSY_DETAIL_NAMESPACE
{
using ::nonstd::span;
using ::ranges::span;
}

#else
Expand Down
4 changes: 4 additions & 0 deletions include/itsy/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
#include <cstddef>
#include <cstdint>

#if (defined(__has_include) && __has_include(<version>))
#include <version>
#endif

#define itsy_bitsy_bit_iterator 201908L
#define itsy_bitsy_bit_view 201908L
#define itsy_bitsy_dynamic_bit_set 201908L
Expand Down
1 change: 1 addition & 0 deletions tests/run_time/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function (make_run_time_tests itsy_bitsy_target target_suffix)
)
target_include_directories(${test-target-name} PRIVATE
../include
../../vendor/span-lite/include
../../vendor/range-v3/include
../../vendor/catch2/include
)
Expand Down

0 comments on commit 234a561

Please sign in to comment.