Skip to content

Commit 4b8b47b

Browse files
Remove CMake config options after SG9 consensus
1 parent 10c358c commit 4b8b47b

File tree

16 files changed

+167
-1122
lines changed

16 files changed

+167
-1122
lines changed

CMakeLists.txt

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,55 +15,6 @@ option(
1515
${PROJECT_IS_TOP_LEVEL}
1616
)
1717

18-
# [CPP.NO_FLAG_FORKING]
19-
set(BEMAN_ANY_VIEW_DESIGN
20-
"ENUM"
21-
CACHE STRING
22-
"Enable alternative design for any_view_options. Default: ENUM. Values: { ENUM, TRAITS, NAMED }."
23-
)
24-
25-
set(BEMAN_ANY_VIEW_OPTION
26-
"COPYABLE"
27-
CACHE STRING
28-
"Enable opt-in option for any_view. Default: COPYABLE. Values: { COPYABLE, MOVE_ONLY }."
29-
)
30-
31-
set(BEMAN_ANY_VIEW_USE_ENUM OFF)
32-
set(BEMAN_ANY_VIEW_USE_TRAITS OFF)
33-
set(BEMAN_ANY_VIEW_USE_NAMED OFF)
34-
set(BEMAN_ANY_VIEW_USE_COPYABLE OFF)
35-
set(BEMAN_ANY_VIEW_USE_MOVE_ONLY OFF)
36-
37-
if(BEMAN_ANY_VIEW_DESIGN STREQUAL "ENUM")
38-
set(BEMAN_ANY_VIEW_USE_ENUM ON)
39-
elseif(BEMAN_ANY_VIEW_DESIGN STREQUAL "TRAITS")
40-
set(BEMAN_ANY_VIEW_USE_TRAITS ON)
41-
elseif(BEMAN_ANY_VIEW_DESIGN STREQUAL "NAMED")
42-
set(BEMAN_ANY_VIEW_USE_NAMED ON)
43-
else()
44-
message(
45-
FATAL_ERROR
46-
"BEMAN_ANY_VIEW_DESIGN must be one of { ENUM, TRAITS, NAMED }; got ${BEMAN_ANY_VIEW_DESIGN}"
47-
)
48-
endif()
49-
50-
if(BEMAN_ANY_VIEW_OPTION STREQUAL "COPYABLE")
51-
set(BEMAN_ANY_VIEW_USE_COPYABLE ON)
52-
elseif(BEMAN_ANY_VIEW_OPTION STREQUAL "MOVE_ONLY")
53-
set(BEMAN_ANY_VIEW_USE_MOVE_ONLY ON)
54-
else()
55-
message(
56-
FATAL_ERROR
57-
"BEMAN_ANY_VIEW_OPTION must be one of { COPYABLE, MOVE_ONLY }; got ${BEMAN_ANY_VIEW_OPTION}"
58-
)
59-
endif()
60-
61-
configure_file(
62-
"${PROJECT_SOURCE_DIR}/include/beman/any_view/config.hpp.in"
63-
"${PROJECT_BINARY_DIR}/include/beman/any_view/config.hpp"
64-
@ONLY
65-
)
66-
6718
include(FetchContent)
6819
include(GNUInstallDirs)
6920

@@ -75,7 +26,6 @@ target_include_directories(
7526
beman.any_view
7627
INTERFACE
7728
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
78-
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
7929
$<INSTALL_INTERFACE:include>
8030
)
8131

README.md

Lines changed: 0 additions & 214 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,9 @@ target_link_libraries(yourlib PUBLIC beman::any_view)
8282

8383
## Reference
8484

85-
### Designs
86-
87-
<details>
88-
<summary><code>ENUM</code> (default)</summary>
89-
9085
Synopsis:
9186

9287
```cpp
93-
#define BEMAN_ANY_VIEW_USE_ENUM() 1
94-
#define BEMAN_ANY_VIEW_USE_TRAITS() 0
95-
#define BEMAN_ANY_VIEW_USE_NAMED() 0
96-
9788
namespace beman::any_view {
9889

9990
enum class any_view_options {
@@ -104,11 +95,7 @@ enum class any_view_options {
10495
contiguous = 0b0001111,
10596
sized = 0b0010000,
10697
borrowed = 0b0100000,
107-
#if BEMAN_ANY_VIEW_USE_COPYABLE()
10898
copyable = 0b1000000,
109-
#elif BEMAN_ANY_VIEW_USE_MOVE_ONLY()
110-
move_only = 0b1000000,
111-
#endif
11299
};
113100

114101
constexpr auto operator|(any_view_options l, any_view_options r) noexcept -> any_view_options;
@@ -133,11 +120,7 @@ class any_view : public std::ranges::view_interface<any_view<ElementT, OptionsV,
133120
using size_type = /*make-unsigned-like-t*/<DiffT>; // exposition-only
134121

135122
static constexpr bool copyable = // exposition-only
136-
#if BEMAN_ANY_VIEW_USE_COPYABLE()
137123
(OptionsV & any_view_options::copyable) == any_view_options::copyable;
138-
#elif BEMAN_ANY_VIEW_USE_MOVE_ONLY()
139-
(OptionsV & any_view_options::move_only) != any_view_options::move_only;
140-
#endif
141124

142125
static constexpr bool sized = // exposition-only
143126
(OptionsV & any_view_options::sized) == any_view_options::sized;
@@ -169,205 +152,8 @@ inline constexpr bool std::ranges::enable_borrowed_range<
169152
(OptionsV & beman::any_view::any_view_options::borrowed) == beman::any_view::any_view_options::borrowed;
170153
```
171154
172-
</details>
173-
174-
<details>
175-
<summary><code>TRAITS</code></summary>
176-
177-
Synopsis:
178-
179-
```cpp
180-
#define BEMAN_ANY_VIEW_USE_ENUM() 0
181-
#define BEMAN_ANY_VIEW_USE_TRAITS() 1
182-
#define BEMAN_ANY_VIEW_USE_NAMED() 0
183-
184-
namespace beman::any_view {
185-
186-
struct default_range_traits {};
187-
188-
template <std::ranges::range RangeT>
189-
struct range_traits {
190-
using iterator_concept = /*range-concept-t*/<RangeT>;
191-
using reference_type = std::ranges::range_reference_t<RangeT>;
192-
using rvalue_reference_type = std::ranges::range_rvalue_reference_t<RangeT>;
193-
using difference_type = std::ranges::range_difference_t<RangeT>;
194-
195-
static constexpr bool sized = std::ranges::sized_range<RangeT>;
196-
static constexpr bool borrowed = std::ranges::borrowed_range<RangeT>;
197-
#if BEMAN_ANY_VIEW_USE_COPYABLE()
198-
static constexpr bool copyable = std::copyable<RangeT>;
199-
#elif BEMAN_ANY_VIEW_USE_MOVE_ONLY()
200-
static constexpr bool move_only = not std::copyable<RangeT>;
201-
#endif
202-
};
203-
204-
template <class ElementT, class RangeTraitsT = default_range_traits>
205-
class any_view : public std::ranges::view_interface<any_view<ElementT, RangeTraitsT>> {
206-
class iterator; // exposition-only
207-
class sentinel; // exposition-only
208-
209-
using difference_type = /*difference-type-or-t*/<std::ptrdiff_t, RangeTraitsT>; // exposition-only
210-
using size_type = /*make-unsigned-like-t*/<difference_type>; // exposition-only
211-
212-
static constexpr bool copyable = // exposition-only
213-
#if BEMAN_ANY_VIEW_USE_COPYABLE()
214-
/*copyable-or-v*/<false, RangeTraitsT>;
215-
#elif BEMAN_ANY_VIEW_USE_MOVE_ONLY()
216-
not /*move-only-or-v*/<false, RangeTraitsT>;
217-
#endif
218-
219-
static constexpr bool sized = /*sized-or-v*/<false, RangeTraitsT>; // exposition-only
220-
221-
public:
222-
template </*viewable-range-compatible-with*/<any_view> RangeT>
223-
constexpr any_view(RangeT&& range);
224-
225-
constexpr any_view(const any_view&) requires copyable;
226-
227-
constexpr any_view(any_view&&) noexcept;
228-
229-
constexpr auto operator=(const any_view&) -> any_view& requires copyable;
230-
231-
constexpr auto operator=(any_view&&) noexcept -> any_view&;
232-
233-
constexpr auto begin() -> iterator;
234-
235-
constexpr auto end() -> sentinel;
236-
237-
constexpr auto size() const -> size_type requires sized;
238-
};
239-
240-
} // namespace beman::any_view
241-
242-
template <class ElementT, class RangeTraitsT>
243-
inline constexpr bool std::ranges::enable_borrowed_range<beman::any_view::any_view<ElementT, RangeTraitsT>> =
244-
/*borrowed-or-v*/<false, RangeTraitsT>;
245-
```
246-
247-
</details>
248-
249-
<details>
250-
<summary><code>NAMED</code></summary>
251-
252-
Synopsis:
253-
254-
```cpp
255-
#define BEMAN_ANY_VIEW_USE_ENUM() 0
256-
#define BEMAN_ANY_VIEW_USE_TRAITS() 0
257-
#define BEMAN_ANY_VIEW_USE_NAMED() 1
258-
259-
namespace beman::any_view {
260-
261-
template <class T>
262-
struct type_t {
263-
using type = T;
264-
};
265-
266-
template <class T>
267-
inline constexpr type_t<T> type{};
268-
269-
template <class RefT,
270-
class IterConceptT = std::input_iterator_tag,
271-
class RValueRefT = /*as-rvalue-t*/<RefT>,
272-
class DiffT = std::ptrdiff_t>
273-
struct any_view_options {
274-
type_t<RefT> reference_type;
275-
type_t<IterConceptT> iterator_concept = {};
276-
bool sized = false;
277-
#if BEMAN_ANY_VIEW_USE_COPYABLE()
278-
bool copyable = false;
279-
#elif BEMAN_ANY_VIEW_USE_MOVE_ONLY()
280-
bool move_only = false;
281-
#endif
282-
bool borrowed = false;
283-
type_t<RValueRefT> rvalue_reference_type = {};
284-
type_t<DiffT> difference_type = {};
285-
};
286-
287-
template <class ElementT, any_view_options OptionsV = {.reference_type = type<ElementT&>}>
288-
class any_view : public std::ranges::view_interface<any_view<ElementT, OptionsV>> {
289-
class iterator; // exposition-only
290-
class sentinel; // exposition-only
291-
292-
using difference_type = decltype(OptionsV.difference_type)::type; // exposition-only
293-
using size_type = /*make-unsigned-like-t*/<difference_type>; // exposition-only
294-
295-
static constexpr bool copyable = // exposition-only
296-
#if BEMAN_ANY_VIEW_USE_COPYABLE()
297-
OptionsV.copyable;
298-
#elif BEMAN_ANY_VIEW_USE_MOVE_ONLY()
299-
not OptionsV.move_only;
300-
#endif
301-
302-
static constexpr bool sized = OptionsV.sized; // exposition-only
303-
304-
public:
305-
template </*viewable-range-compatible-with*/<any_view> RangeT>
306-
constexpr any_view(RangeT&& range);
307-
308-
constexpr any_view(const any_view&) requires copyable;
309-
310-
constexpr any_view(any_view&&) noexcept;
311-
312-
constexpr auto operator=(const any_view&) -> any_view& requires copyable;
313-
314-
constexpr auto operator=(any_view&&) noexcept -> any_view&;
315-
316-
constexpr auto begin() -> iterator;
317-
318-
constexpr auto end() -> sentinel;
319-
320-
constexpr auto size() const -> size_type requires sized;
321-
};
322-
323-
} // namespace beman::any_view
324-
325-
template <class ElementT, auto OptionsV>
326-
inline constexpr bool std::ranges::enable_borrowed_range<beman::any_view::any_view<ElementT, OptionsV>> =
327-
OptionsV.borrowed;
328-
```
329-
330-
</details>
331-
332-
### Options
333-
334-
<details>
335-
<summary><code>COPYABLE</code> (default)</summary>
336-
337-
Synopsis:
338-
339-
```cpp
340-
#define BEMAN_ANY_VIEW_USE_COPYABLE() 1
341-
#define BEMAN_ANY_VIEW_USE_MOVE_ONLY() 0
342-
```
343-
344-
</details>
345-
346-
<details>
347-
<summary><code>MOVE_ONLY</code></summary>
348-
349-
Synopsis:
350-
351-
```cpp
352-
#define BEMAN_ANY_VIEW_USE_COPYABLE() 0
353-
#define BEMAN_ANY_VIEW_USE_MOVE_ONLY() 1
354-
```
355-
356-
</details>
357-
358155
## Building
359156
360-
### CMake configuration variables
361-
362-
```text
363-
-DBEMAN_ANY_VIEW_DESIGN=ENUM
364-
-DBEMAN_ANY_VIEW_DESIGN=TRAITS
365-
-DBEMAN_ANY_VIEW_DESIGN=NAMED
366-
367-
-DBEMAN_ANY_VIEW_OPTION=COPYABLE
368-
-DBEMAN_ANY_VIEW_OPTION=MOVE_ONLY
369-
```
370-
371157
There are workflows available in CMake presets such as `gcc-debug`:
372158
373159
```bash

0 commit comments

Comments
 (0)