Embedded Template Library 1.0
expected.h
Go to the documentation of this file.
1
2
3/******************************************************************************
4The MIT License(MIT)
5
6Embedded Template Library.
7https://github.com/ETLCPP/etl
8https://www.etlcpp.com
9
10Copyright(c) 2022 John Wellbelove
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files(the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions :
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29******************************************************************************/
30
31#ifndef ETL_EXPECTED_INCLUDED
32#define ETL_EXPECTED_INCLUDED
33
36#include "platform.h"
37#include "exception.h"
38#include "error_handler.h"
39#include "utility.h"
40#include "variant.h"
41
42namespace etl
43{
44 //***************************************************************************
46 //***************************************************************************
48 {
49 public:
50
51 expected_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
52 : exception(reason_, file_name_, line_number_)
53 {
54 }
55 };
56
57 //***************************************************************************
59 //***************************************************************************
60 template <typename TError>
61 class expected_invalid;
62
63 //*******************************************
64 template<>
66 {
67 public:
68
69 expected_invalid(string_type file_name_, numeric_type line_number_)
70 : expected_exception(ETL_ERROR_TEXT("expected:invalid", ETL_EXPECTED_FILE_ID"A"), file_name_, line_number_)
71 {
72 }
73 };
74
75 //*******************************************
76 template <typename TError>
78 {
79 public:
80
81 expected_invalid(string_type file_name_, numeric_type line_number_)
82 : expected_invalid<void>(file_name_, line_number_)
83 {
84 }
85 };
86
87 //***************************************************************************
90 //***************************************************************************
91 template <typename TError>
93 {
94 public:
95
96 typedef TError error_type;
97
98 //*******************************************
100 //*******************************************
101 ETL_CONSTEXPR unexpected(const unexpected& other)
102 : error_value(other.error_value)
103 {
104 }
105
106#if ETL_USING_CPP11
107 //*******************************************
109 //*******************************************
110 ETL_CONSTEXPR unexpected(unexpected&& other)
111 : error_value(etl::move(other.error_value))
112 {
113 }
114#endif
115
116 //*******************************************
118 //*******************************************
119 ETL_CONSTEXPR explicit unexpected(const TError& e)
120 : error_value(e)
121 {
122 }
123
124#if ETL_USING_CPP11
125 //*******************************************
127 //*******************************************
128 ETL_CONSTEXPR explicit unexpected(TError&& e)
129 : error_value(etl::forward<TError>(e))
130 {
131 }
132
133 //*******************************************
135 //*******************************************
136 template <typename... Args >
137 ETL_CONSTEXPR explicit unexpected(etl::in_place_t, Args&&... args)
138 : error_value(etl::forward<Args>(args)...)
139 {
140 }
141#endif
142
143#if ETL_HAS_INITIALIZER_LIST
144 //*******************************************
146 //*******************************************
147 template <typename U, typename... Args>
148 ETL_CONSTEXPR explicit unexpected(etl::in_place_t, std::initializer_list<U> init, Args&&... args)
149 : error_value(init, etl::forward<Args>(args)...)
150 {
151 }
152#endif
153
154 //*******************************************
156 //*******************************************
157 ETL_CONSTEXPR14
159 {
160 ETL_STATIC_ASSERT(etl::is_copy_constructible<TError>::value, "Error not copy assignable");
161
162 error_value = rhs.error_value;
163 return *this;
164 }
165
166#if ETL_USING_CPP11
167 //*******************************************
169 //*******************************************
170 ETL_CONSTEXPR14
172 {
173 ETL_STATIC_ASSERT(etl::is_move_constructible<TError>::value, "Error not move assignable");
174
175 error_value = etl::move(rhs.error_value);
176 return *this;
177 }
178#endif
179
180#if ETL_USING_CPP11
181 //*******************************************
183 //*******************************************
184 ETL_CONSTEXPR14 TError& error()& ETL_NOEXCEPT
185 {
186 return error_value;
187 }
188
189 //*******************************************
191 //*******************************************
192 ETL_CONSTEXPR14 const TError& error() const& ETL_NOEXCEPT
193 {
194 return error_value;
195 }
196
197 //*******************************************
199 //*******************************************
200 ETL_CONSTEXPR14 TError&& error()&& ETL_NOEXCEPT
201 {
202 return etl::move(error_value);
203 }
204
205 //*******************************************
207 //*******************************************
208 ETL_CONSTEXPR14 TError&& error() const&& ETL_NOEXCEPT
209 {
210 return etl::move(error_value);
211 }
212#else
213 //*******************************************
215 //*******************************************
216 const TError& error() const
217 {
218 return error_value;
219 }
220#endif
221
222 //*******************************************
224 //*******************************************
226 {
227 using ETL_OR_STD::swap;
228
229 swap(error_value, other.error_value);
230 }
231
232 private:
233
234 TError error_value;
235 };
236
237 //*****************************************************************************
239 //*****************************************************************************
241 {
242 ETL_CONSTEXPR14 explicit unexpect_t()
243 {
244 }
245 };
246
247#if ETL_USING_CPP17
248 inline ETL_CONSTEXPR unexpect_t unexpect{};
249#else
250 static const unexpect_t unexpect;
251#endif
252
253 //*****************************************************************************
255 //*****************************************************************************
256 template <typename TValue, typename TError>
258 {
259 public:
260
262 typedef TValue value_type;
263 typedef TError error_type;
265
266#if ETL_USING_CPP11
267 template <typename U>
268 using rebind = expected<U, TError>;
269#endif
270
271 //*******************************************
273 //*******************************************
274 ETL_CONSTEXPR14 expected() ETL_NOEXCEPT
275 : storage(etl::in_place_index_t<Value_Type>(), value_type())
276 {
277 }
278
279 //*******************************************
281 //*******************************************
282 ETL_CONSTEXPR14 expected(const value_type& value_) ETL_NOEXCEPT
283 : storage(etl::in_place_index_t<Value_Type>(), value_)
284 {
285 }
286
287#if ETL_USING_CPP11
288 //*******************************************
290 //*******************************************
291 ETL_CONSTEXPR14 expected(value_type&& value_) ETL_NOEXCEPT
292 : storage(etl::in_place_index_t<Value_Type>(), etl::move(value_))
293 {
294 }
295#endif
296
297 //*******************************************
299 //*******************************************
300 ETL_CONSTEXPR14 expected(const expected& other) ETL_NOEXCEPT
301 : storage(other.storage)
302 {
303 }
304
305#if ETL_USING_CPP11
306 //*******************************************
308 //*******************************************
309 ETL_CONSTEXPR14 expected(expected&& other) ETL_NOEXCEPT
310 : storage(etl::move(other.storage))
311 {
312 }
313#endif
314
315#if ETL_USING_CPP11
316 //*******************************************
318 //*******************************************
319 template <typename G, typename etl::enable_if<!etl::is_convertible<const G&, TError>::value, bool>::type = false>
320 ETL_CONSTEXPR14 explicit expected(const etl::unexpected<G>& ue)
321 : storage(etl::in_place_index_t<Error_Type>(), ue.error())
322 {
323 }
324
325 template <typename G, typename etl::enable_if<etl::is_convertible<const G&, TError>::value, bool>::type = false>
326 ETL_CONSTEXPR14 expected(const etl::unexpected<G>& ue)
327 : storage(etl::in_place_index_t<Error_Type>(), ue.error())
328 {
329 }
330#else
331 template <typename G>
332 explicit expected(const etl::unexpected<G>& ue)
333 : storage(etl::in_place_index_t<Error_Type>(), ue.error())
334 {
335 }
336#endif
337
338#if ETL_USING_CPP11
339 //*******************************************
341 //*******************************************
342 template <typename G, typename etl::enable_if<!etl::is_convertible<const G&, TError>::value, bool>::type = false>
343 ETL_CONSTEXPR14 explicit expected(etl::unexpected<G>&& ue)
344 : storage(etl::in_place_index_t<Error_Type>(), etl::move(ue.error()))
345 {
346 }
347
348 template <typename G, typename etl::enable_if<etl::is_convertible<const G&, TError>::value, bool>::type = false>
349 ETL_CONSTEXPR14 expected(etl::unexpected<G>&& ue)
350 : storage(etl::in_place_index_t<Error_Type>(), etl::move(ue.error()))
351 {
352 }
353#endif
354
355 //*******************************************
357 //*******************************************
358 ETL_CONSTEXPR14 explicit expected(etl::in_place_t) ETL_NOEXCEPT
359 : storage(value_type())
360 {
361 }
362
363#if ETL_USING_CPP11
364 //*******************************************
366 //*******************************************
367 template <typename... Args>
368 ETL_CONSTEXPR14 explicit expected(etl::in_place_t, Args&&... args)
369 : storage(etl::forward<Args>(args)...)
370 {
371 }
372
373 //*******************************************
375 //*******************************************
376 template <typename U, typename... Args>
377 ETL_CONSTEXPR14 explicit expected(etl::in_place_t, std::initializer_list<U> il, Args&&... args)
378 : storage(il, etl::forward<Args>(args)...)
379 {
380 }
381
382 //*******************************************
384 //*******************************************
385 template <typename... Args>
386 ETL_CONSTEXPR14 explicit expected(etl::unexpect_t, Args&&... args)
387 : storage(error_type(etl::forward<Args>(args)...))
388 {
389 }
390
391#if ETL_HAS_INITIALIZER_LIST
392 //*******************************************
394 //*******************************************
395 template <typename U, typename... Args>
396 ETL_CONSTEXPR14 explicit expected(etl::unexpect_t, std::initializer_list<U> il, Args&&... args)
397 : storage(error_type(il, etl::forward<Args>(args)...))
398 {
399 }
400#endif
401#endif
402
403 //*******************************************
405 //*******************************************
406 this_type& operator =(const this_type& other)
407 {
409
410 storage = other.storage;
411
412 return *this;
413 }
414
415#if ETL_USING_CPP11
416 //*******************************************
418 //*******************************************
419 this_type& operator =(this_type&& other)
420 {
422
423 storage = etl::move(other.storage);
424 return *this;
425 }
426#endif
427
428 //*******************************************
430 //*******************************************
431 expected& operator =(const value_type& value)
432 {
433 ETL_STATIC_ASSERT(etl::is_copy_constructible<TValue>::value, "Value not copy assignable");
434
435 storage = value;
436 return *this;
437 }
438
439#if ETL_USING_CPP11
440 //*******************************************
442 //*******************************************
443 expected& operator =(value_type&& value)
444 {
445 ETL_STATIC_ASSERT(etl::is_move_constructible<TValue>::value, "Value not move assignable");
446
447 storage = etl::move(value);
448 return *this;
449 }
450#endif
451
452 //*******************************************
454 //*******************************************
455 expected& operator =(const unexpected_type& ue)
456 {
457 ETL_STATIC_ASSERT(etl::is_copy_constructible<TError>::value, "Error not copy assignable");
458
459 storage = ue.error();
460
461 return *this;
462 }
463
464#if ETL_USING_CPP11
465 //*******************************************
467 //*******************************************
468 expected& operator =(unexpected_type&& ue)
469 {
470 ETL_STATIC_ASSERT(etl::is_move_constructible<TError>::value, "Error not move assignable");
471
472 storage = etl::move(ue.error());
473
474 return *this;
475 }
476#endif
477
478#if ETL_USING_CPP11
479 //*******************************************
481 //*******************************************
482 ETL_CONSTEXPR14 value_type& value()&
483 {
484 return etl::get<Value_Type>(storage);
485 }
486
487 //*******************************************
489 //*******************************************
490 ETL_CONSTEXPR14 const value_type& value() const&
491 {
492 return etl::get<Value_Type>(storage);
493 }
494
495 //*******************************************
497 //*******************************************
498 ETL_CONSTEXPR14 value_type&& value()&&
499 {
500 return etl::move(etl::get<Value_Type>(storage));
501 }
502
503 //*******************************************
505 //*******************************************
506 ETL_CONSTEXPR14 const value_type&& value() const&&
507 {
508 return etl::move(etl::get<Value_Type>(storage));
509 }
510#else
511 //*******************************************
513 //*******************************************
514 value_type& value() const
515 {
516 return etl::get<Value_Type>(storage);
517 }
518#endif
519
520 //*******************************************
522 //*******************************************
523 ETL_NODISCARD
524 ETL_CONSTEXPR14
525 bool has_value() const
526 {
527 return (storage.index() == Value_Type);
528 }
529
530 //*******************************************
532 //*******************************************
533 ETL_NODISCARD
534 ETL_CONSTEXPR14
535 operator bool() const
536 {
537 return has_value();
538 }
539
540#if ETL_USING_CPP11
541 //*******************************************
543 //*******************************************
544 template <typename U>
545 ETL_NODISCARD
546 ETL_CONSTEXPR14
547 etl::enable_if_t<etl::is_convertible<U, value_type>::value, value_type>
548 value_or(U&& default_value) const&
549 {
550 if (has_value())
551 {
552 return value();
553 }
554 else
555 {
556 return static_cast<value_type>(etl::forward<U>(default_value));
557 }
558 }
559
560 //*******************************************
562 //*******************************************
563 template <typename U>
564 ETL_NODISCARD
565 ETL_CONSTEXPR14
566 etl::enable_if_t<etl::is_convertible<U, value_type>::value, value_type>
567 value_or(U&& default_value)&&
568 {
569 if (has_value())
570 {
571 return etl::move(value());
572 }
573 else
574 {
575 return static_cast<value_type>(etl::forward<U>(default_value));
576 }
577 }
578
579 //*******************************************
581 //*******************************************
582 ETL_NODISCARD
583 ETL_CONSTEXPR14
584 error_type& error()& ETL_NOEXCEPT
585 {
586 return etl::get<Error_Type>(storage);
587 }
588
589 //*******************************************
591 //*******************************************
592 ETL_NODISCARD
593 ETL_CONSTEXPR14
594 const error_type& error() const& ETL_NOEXCEPT
595 {
596 return etl::get<Error_Type>(storage);
597 }
598
599 //*******************************************
601 //*******************************************
602 ETL_NODISCARD
603 ETL_CONSTEXPR14
604 error_type&& error()&& ETL_NOEXCEPT
605 {
606 return etl::move(etl::get<Error_Type>(storage));
607 }
608
609 //*******************************************
611 //*******************************************
612 ETL_NODISCARD
613 ETL_CONSTEXPR14
614 const error_type&& error() const&& ETL_NOEXCEPT
615 {
616 return etl::move(etl::get<Error_Type>(storage));
617 }
618
619 //*******************************************
621 //*******************************************
622 template <typename... Args>
623 ETL_CONSTEXPR14 value_type& emplace(Args&&... args) ETL_NOEXCEPT
624 {
625 storage.emplace(etl::forward<Args>(args)...);
626 }
627
628 //*******************************************
630 //*******************************************
631 template <typename U, typename... Args>
632 ETL_CONSTEXPR14 value_type& emplace(std::initializer_list<U>& il, Args&&... args) ETL_NOEXCEPT
633 {
634 storage.emplace(il, etl::forward<Args>(args)...);
635 }
636#else
637 //*******************************************
639 //*******************************************
640 template <typename U>
641 value_type value_or(const U& default_value) const
642 {
643 if (has_value())
644 {
645 return value();
646 }
647 else
648 {
649 return default_value;
650 }
651 }
652
653 //*******************************************
655 //*******************************************
656 error_type& error() const
657 {
658 return etl::get<Error_Type>(storage);
659 }
660#endif
661
662 //*******************************************
664 //*******************************************
665 value_type* operator ->()
666 {
667#if ETL_IS_DEBUG_BUILD
668 ETL_ASSERT(storage.index() == Value_Type, ETL_ERROR(expected_invalid<TError>));
669#endif
670
671 return etl::addressof(etl::get<value_type>(storage));
672 }
673
674 //*******************************************
676 //*******************************************
677 const value_type* operator ->() const
678 {
679#if ETL_IS_DEBUG_BUILD
680 ETL_ASSERT(storage.index() == Value_Type, ETL_ERROR(expected_invalid<TError>));
681#endif
682
683 return etl::addressof(etl::get<value_type>(storage));
684 }
685
686 //*******************************************
688 //*******************************************
689 value_type& operator *() ETL_LVALUE_REF_QUALIFIER
690 {
691#if ETL_IS_DEBUG_BUILD
692 ETL_ASSERT(storage.index() == Value_Type, ETL_ERROR(expected_invalid<TError>));
693#endif
694
695 return etl::get<value_type>(storage);
696 }
697
698 //*******************************************
700 //*******************************************
701 const value_type& operator *() const ETL_LVALUE_REF_QUALIFIER
702 {
703#if ETL_IS_DEBUG_BUILD
704 ETL_ASSERT(storage.index() == Value_Type, ETL_ERROR(expected_invalid<TError>));
705#endif
706
707 return etl::get<value_type>(storage);
708 }
709
710#if ETL_USING_CPP11
711 //*******************************************
713 //*******************************************
714 value_type&& operator *()&&
715 {
716#if ETL_IS_DEBUG_BUILD
717 ETL_ASSERT(storage.index() == Value_Type, ETL_ERROR(expected_invalid<TError>));
718#endif
719
720 return etl::move(etl::get<value_type>(storage));
721 }
722
723 //*******************************************
725 //*******************************************
726 const value_type&& operator *() const&&
727 {
728#if ETL_IS_DEBUG_BUILD
729 ETL_ASSERT(storage.index() == Value_Type, ETL_ERROR(expected_invalid<TError>));
730#endif
731
732 return etl::move(etl::get<value_type>(storage));
733 }
734#endif
735
736 private:
737
738 enum
739 {
740 Uninitialised,
741 Value_Type,
742 Error_Type
743 };
744
746 storage_type storage;
747 };
748
749 //*****************************************************************************
751 //*****************************************************************************
752 template<typename TError>
753 class expected<void, TError>
754 {
755 public:
756
758 typedef void value_type;
759 typedef TError error_type;
761
762 //*******************************************
764 //*******************************************
765 ETL_CONSTEXPR14
767 {
768 }
769
770 //*******************************************
772 //*******************************************
773 ETL_CONSTEXPR14
775 : storage(ue_.error())
776 {
777 }
778
779#if ETL_USING_CPP11
780 //*******************************************
782 //*******************************************
783 ETL_CONSTEXPR14
784 expected(unexpected_type&& ue_)
785 : storage(etl::move(ue_.error()))
786 {
787 }
788#endif
789
790 //*******************************************
792 //*******************************************
793 ETL_CONSTEXPR14
794 expected(const this_type& other)
795 : storage(other.storage)
796 {
797 }
798
799#if ETL_USING_CPP11
800 //*******************************************
802 //*******************************************
803 ETL_CONSTEXPR14
804 expected(this_type&& other)
805 : storage(etl::move(other.storage))
806 {
807 }
808#endif
809
810 //*******************************************
812 //*******************************************
813 this_type& operator =(const this_type& other)
814 {
815 ETL_STATIC_ASSERT(etl::is_copy_constructible<TError>::value, "Not copy assignable");
816
817 storage = other.storage;
818 return *this;
819 }
820
821#if ETL_USING_CPP11
822 //*******************************************
824 //*******************************************
825 this_type& operator =(this_type&& other)
826 {
827 ETL_STATIC_ASSERT(etl::is_move_constructible<TError>::value, "Not move assignable");
828
829 storage = etl::move(other.storage);
830 return *this;
831 }
832#endif
833
834 //*******************************************
836 //*******************************************
837 expected& operator =(const unexpected_type& ue)
838 {
839 ETL_STATIC_ASSERT(etl::is_copy_constructible<TError>::value, "Error not copy assignable");
840
841 storage.template emplace<Error_Type>(ue.error());
842 return *this;
843 }
844
845#if ETL_USING_CPP11
846 //*******************************************
848 //*******************************************
849 expected& operator =(unexpected_type&& ue)
850 {
851 ETL_STATIC_ASSERT(etl::is_move_constructible<TError>::value, "Error not move assignable");
852
853 storage.template emplace<Error_Type>(etl::move(ue.error()));
854 return *this;
855 }
856#endif
857
858 //*******************************************
860 //*******************************************
861 ETL_NODISCARD
862 ETL_CONSTEXPR14
863 bool has_value() const
864 {
865 return (storage.index() != Error_Type);
866 }
867
868 //*******************************************
870 //*******************************************
871 ETL_NODISCARD
872 ETL_CONSTEXPR14
873 operator bool() const
874 {
875 return has_value();
876 }
877
878#if ETL_USING_CPP11
879 //*******************************************
882 //*******************************************
883 ETL_NODISCARD
884 ETL_CONSTEXPR14
885 error_type& error()& ETL_NOEXCEPT
886 {
887 return etl::get<Error_Type>(storage);
888 }
889
890 //*******************************************
893 //*******************************************
894 ETL_NODISCARD
895 ETL_CONSTEXPR14
896 const error_type& error() const& ETL_NOEXCEPT
897 {
898 return etl::get<Error_Type>(storage);
899 }
900
901 //*******************************************
904 //*******************************************
905 ETL_NODISCARD
906 ETL_CONSTEXPR14
907 error_type&& error() && ETL_NOEXCEPT
908 {
909 return etl::move(etl::get<Error_Type>(storage));
910 }
911
912 //*******************************************
915 //*******************************************
916 ETL_NODISCARD
917 ETL_CONSTEXPR14
918 const error_type&& error() const&& ETL_NOEXCEPT
919 {
920 return etl::move(etl::get<Error_Type>(storage));
921 }
922#else
923 //*******************************************
926 //*******************************************
927 error_type& error() const
928 {
929 return etl::get<Error_Type>(storage);
930 }
931#endif
932
933 private:
934
935 enum
936 {
937 Uninitialised,
938 Error_Type
939 };
940
942 };
943}
944
945//*******************************************
947//*******************************************
948template <typename TError>
949ETL_CONSTEXPR14
951{
952 return lhs.error_value == rhs.error_value;
953}
954
955//*******************************************
957//*******************************************
958template <typename TError>
959ETL_CONSTEXPR14
961{
962 lhs.swap(rhs);
963}
964
965#endif
966
Specialisation for void value type.
Definition: expected.h:754
error_type & error() const
Definition: expected.h:927
ETL_CONSTEXPR14 expected()
Default constructor.
Definition: expected.h:766
ETL_NODISCARD ETL_CONSTEXPR14 bool has_value() const
Returns true if expected has a value.
Definition: expected.h:863
ETL_CONSTEXPR14 expected(const unexpected_type &ue_)
Copy construct from unexpected.
Definition: expected.h:774
ETL_CONSTEXPR14 expected(const this_type &other)
Copy construct.
Definition: expected.h:794
Base exception for et::expected.
Definition: expected.h:48
Definition: expected.h:66
expected_invalid
Definition: expected.h:78
Expected type.
Definition: expected.h:258
ETL_CONSTEXPR14 expected() ETL_NOEXCEPT
Default constructor.
Definition: expected.h:274
value_type & value() const
Get the value.
Definition: expected.h:514
Definition: expected.h:93
const TError & error() const
Get the error.
Definition: expected.h:216
void swap(etl::unexpected< TError > &other)
Swap with another etl::unexpected.
Definition: expected.h:225
ETL_CONSTEXPR unexpected(const unexpected &other)
Copy constructor.
Definition: expected.h:101
ETL_CONSTEXPR14 etl::unexpected< TError > & operator=(const etl::unexpected< TError > &rhs)
Assign from etl::unexpected.
Definition: expected.h:158
ETL_CONSTEXPR14 void swap(etl::unexpected< TError > &lhs, etl::unexpected< TError > &rhs)
Swap etl::unexpected.
Definition: expected.h:960
ETL_CONSTEXPR14 bool operator==(const etl::unexpected< TError > &lhs, const etl::unexpected< TError > &rhs)
Equivalence operator.
Definition: expected.h:950
#define ETL_ASSERT(b, e)
Definition: error_handler.h:316
ETL_CONSTEXPR exception(string_type reason_, string_type, numeric_type line_)
Constructor.
Definition: exception.h:69
Definition: exception.h:47
ETL_CONSTEXPR17 T * addressof(T &t)
Definition: addressof.h:51
T & emplace(const TP1 &value1)
Emplace with one constructor parameter.
Definition: variant_legacy.h:527
size_t index() const
Gets the index of the type currently stored or UNSUPPORTED_TYPE_ID.
Definition: variant_legacy.h:707
bitset_ext
Definition: absolute.h:38
Definition: utility.h:591
in_place disambiguation tags.
Definition: utility.h:570
Definition: type_traits_generator.h:2026
Definition: type_traits_generator.h:2033
unexpect_t
Definition: expected.h:241