Comments (8)
Thank you very much for your report.
I hope I fixed it (it's on master):
cista/include/cista/containers/variant.h
Lines 379 to 384 in 0848575
from cista.
I have better issue description from gcc, here below:
cista/include/cista/containers/variant.h
Line 382 in 23875ef
quote:
[pointing on "=="]
error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
return v.idx_ == &cista::index_of_type<T, Ts...> ? v.template as()
[pointing on "?"]
error: operands to '?:' have different types 'bool' and 'std::nullptr_t'
return v.idx_ == &cista::index_of_type<T, Ts...> ? v.template as()
from cista.
Whoa! That was quick... :)
from cista.
Almost :)
It works until recurring reference container is added to the variant, i.e. CISTA::unique_ptr<Test>
below:
struct Test;
using Variant = CISTA::variant
<
bool,
std::int64_t,
std::uint64_t,
double,
CISTA::string,
CISTA::unique_ptr<int>,
CISTA::unique_ptr<Test>
>;
struct Test : public CISTA::vector<Variant>
{
};
////////////////////////////////////////////////////////////////////////////////
Variant test{ true };
auto result = cista::get_if<bool>(test);
Same errors on MSVS
from cista.
This test case works for me:
TEST_CASE("variant get_if") {
namespace CISTA = cista::offset;
struct Test;
using Variant =
CISTA::variant<bool, std::int64_t, std::uint64_t, double, CISTA::string,
CISTA::unique_ptr<int>, CISTA::unique_ptr<Test>>;
struct Test : public CISTA::vector<Variant> {};
Variant test{true};
auto const result = cista::get_if<bool>(test);
REQUIRE(result != nullptr);
CHECK(*result == true);
test = CISTA::string{"hello test test test test"};
auto const str = cista::get_if<CISTA::string>(test);
REQUIRE(str != nullptr);
CHECK(*str == "hello test test test test");
}
Checking to see if it breaks in GitHub Actions.
da8da3a
Edit: seems the CI build works
https://github.com/felixguendling/cista/actions/runs/1035547916
from cista.
btw: cista::get_if<>(const& v) should be also patched:
cista/include/cista/containers/variant.h
Lines 402 to 408 in da8da3a
from cista.
Should be fixed now by eb050ae
from cista.
Indeed, thank you.
from cista.
Related Issues (20)
- Discussion: STL containers can actually be supported ? HOT 3
- Help: Serialization and inheritance (with standard layout classes) HOT 22
- Wiki Typo HOT 1
- Any plans for c++20? HOT 2
- cista_members() approach: serialize tuples properly HOT 2
- nigiri Branch entfernt HOT 1
- Dealing with Data Pointer Offset in Checked Mode HOT 4
- Documentation request: how to build and run tests HOT 6
- Silence clang specific #pragma directives for other compilers ? HOT 2
- Static type hashing of std::complex HOT 5
- Create a stable release branch HOT 5
- Missing const& specifier for return type
- Cleanup: static_cast for `adjustment` should be `offset_t` since `start` is that type
- Support storing trailing \0 byte at the end of string HOT 5
- Support for `resize` [perhaps also `capacity` and `reserve`] for cista::generic_string/basic_string HOT 2
- String gives different size at "empty" input for short/non_short HOT 1
- MSVC v14.1x build error: C2296,C2297 HOT 3
- How can I serialize a struct which contains anonymous union member HOT 2
- Bug in std_vector_test.cc HOT 1
- Support for std::visit HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cista.