-
Notifications
You must be signed in to change notification settings - Fork 274
Variant submodule #4344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variant submodule #4344
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
big-int | ||
mach # system | ||
malloc # system | ||
mpark | ||
nonstd | ||
sys # system | ||
util | ||
|
||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*******************************************************************\ | ||
|
||
Module: typedef for variant class template. To be replaced with | ||
std::variant once C++17 support is enabled | ||
|
||
Author: Diffblue Ltd. | ||
|
||
\*******************************************************************/ | ||
|
||
#ifndef CPROVER_UTIL_VARIANT_H | ||
#define CPROVER_UTIL_VARIANT_H | ||
|
||
#include <mpark/variant.hpp> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose this works with CMake, but shouldn't this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So only the util includes need to change, since all other users should use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, but the |
||
|
||
template <typename... Ts> | ||
using variantt = mpark::variant<Ts...>; | ||
|
||
#endif // CPROVER_UTIL_VARIANT_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2016-2019 Diffblue Limited. All Rights Reserved. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong copyright header |
||
|
||
#include <testing-utils/use_catch.h> | ||
#include <util/variant.h> | ||
|
||
TEST_CASE("Ensure variant has been included", "[core][util][variant]") | ||
{ | ||
variantt<int, float> some_type = 1; | ||
REQUIRE(some_type.index() == 0); | ||
some_type = 1.0f; | ||
REQUIRE(some_type.index() == 1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed