File tree Expand file tree Collapse file tree 5 files changed +35
-1
lines changed Expand file tree Collapse file tree 5 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
113
113
endif ()
114
114
endif ()
115
115
116
+ add_subdirectory (lib/variant)
117
+
116
118
add_subdirectory (src)
117
119
add_subdirectory (regression)
118
120
add_subdirectory (unit)
Original file line number Diff line number Diff line change @@ -47,4 +47,4 @@ add_dependencies(util generate_version_cpp)
47
47
48
48
generic_includes(util)
49
49
50
- target_link_libraries (util big-int langapi)
50
+ target_link_libraries (util big-int langapi mpark_variant )
Original file line number Diff line number Diff line change 1
1
big-int
2
2
mach # system
3
3
malloc # system
4
+ mpark
4
5
nonstd
5
6
sys # system
6
7
util
8
+
Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: typedef for optional class template. To be replaced with
4
+ std::optional once C++17 support is enabled
5
+
6
+ Author: Diffblue Ltd.
7
+
8
+ \*******************************************************************/
9
+
10
+ #ifndef CPROVER_UTIL_VARIANT_H
11
+ #define CPROVER_UTIL_VARIANT_H
12
+
13
+ #include < mpark/variant.hpp>
14
+
15
+ template <typename ... Ts>
16
+ using variantt = mpark::variant<Ts...>;
17
+
18
+ #endif // CPROVER_UTIL_VARIANT_H
Original file line number Diff line number Diff line change
1
+ // Copyright 2016-2019 Diffblue Limited. All Rights Reserved.
2
+
3
+ #include < testing-utils/use_catch.h>
4
+ #include < util/variant.h>
5
+
6
+ TEST_CASE (" Ensure variant has been included" , " [core][util][variant]" )
7
+ {
8
+ variantt<int , float > some_type = 1 ;
9
+ REQUIRE (some_type.index () == 0 );
10
+ some_type = 1 .0f ;
11
+ REQUIRE (some_type.index () == 1 );
12
+ }
You can’t perform that action at this time.
0 commit comments