variant Questions

1

Solved

I am investigating several Visual Studio 2015 C++ project types which use ADO to access an SQL Server database. The simple example performs a select against a table, reads in the rows, updates each...
Drysalter asked 3/9, 2016 at 16:36

2

Solved

My aim is to write std::variant, may be not full blown, but at least with fully working constructor/destructor pair and std::get<>() function. I tried to reserve a memory using char array. T...
Michael asked 2/9, 2016 at 15:37

1

Solved

Why does constructor (4) exist for std::variant from http://en.cppreference.com/w/cpp/utility/variant/variant? It seems like it is going to cause a lot of ambiguity in code that could otherwise hav...
Pneumonic asked 30/8, 2016 at 21:55

3

Solved

I am looking for an alternative to C-style union. boost::variant is one such option. Is there anything in std C++ ? union { int i; double d; }
Widely asked 22/3, 2012 at 22:0

5

Solved

I have a boost::variant in my program and I want to check if the variant itself is initialized and also if there is a value contained in one of it's types. I've tried empty() on the variant, but t...
Priapitis asked 15/3, 2011 at 13:15

3

Solved

Here's my problem: I want to create a record type where among the cases of a variant record, some, but not all, will have a certain field. According to the wiki, this is perfectly legal. And yet, w...
Besprent asked 21/4, 2016 at 6:24

2

Suppose, for example, you want to implement a spreadsheet Cell in C++. A cell can be either a string, a number, or perhaps empty. Ignore other cases, like it being a formula. In Haskell, you migh...
Quick asked 29/3, 2016 at 11:49

3

I want to create a VARIANT or _variant_t from a FILETIME in c/c++. Basically, this is what I want: FILETIME ft; //Populate ft VARIANT vFt; VariantInit(&vFt); vFt.vt = VT_FILETIME; Now,...
Kashmir asked 29/3, 2012 at 6:53

1

Solved

I am under mac OS X, and using excel-2011 vba. I know how to pass various types from VBA to c++ and inversely, mainly thanks to this. Now, I would like to know if it is possible to somehow pass a ...
Incorporeal asked 30/8, 2015 at 22:29

1

Say you are writing an app in OCaml/F#/SML/Haskell and want to persist data in a relational database. It is easy to map product types (records and tuples) to relations, but how do you map variant t...
Felike asked 19/10, 2015 at 11:18

3

Solved

Given a variant, does VBScript have an equivalent of C#'s DateTime.TryParse method?
Helianthus asked 25/3, 2010 at 16:22

2

Probably I am not the first person finding out that std::exception_ptr could be used to implement an any type (performance considerations being put aside), as it is probably the only type in C++ th...
Overbite asked 21/12, 2015 at 8:13

2

Solved

I'm trying to read and write to the IIS 6 metabase using Inno Setup. I can't figure out how to access arrays though. IIS := CreateOleObject('IISNamespace'); Compr := IIS.GetObject('IIsCompressionS...
Gerhardine asked 16/12, 2015 at 17:2

2

Solved

Is it permitable to design std::optional (currently std::experimental::optional) in such a way, that for trivially default constructible type T corresponding std::optional< T > is also trivia...
Krieger asked 3/12, 2015 at 8:29

1

Solved

Playing with constexpr and union I found out, that I can't change active member of an union in constexpr. Just one exception: union of empty classes. constexpr bool t() { struct A {}; struct B {...
Ifill asked 26/11, 2015 at 10:32

4

I've read and heard several times that sql_variant should be avoided. I think I have a great use case for it. I've used varchar(max) in the past to store different types in the same column, but it ...
Hexachord asked 20/10, 2011 at 16:33

6

Solved

I want to store mixed data types in an array. How could one do that?
Bidding asked 2/9, 2013 at 16:26

2

Solved

I have defined a boost::variant var like this: boost::variant<boost::blank, bool, int> foo; This variable, when instantiated but not initialized, has a value of type boost::blank, because ...
Shabuoth asked 9/7, 2015 at 14:43

2

Solved

I am setting up project that has a dependancy to one module, and I could successfully make APK file. All I did was adding compile project(':ModuleName') However I am wondering if I can have mo...
Odel asked 25/11, 2014 at 18:35

2

Solved

I'm trying to measure a performance difference between using Boost.Variant and using virtual interfaces. For example, suppose I want to increment different types of numbers uniformly, using Boost.V...
Treehopper asked 10/8, 2012 at 17:46

1

Solved

In a variant class I'm working on the raw storage is a char array: alignas(/* the strictest alignment of all types of the variant */) char storage[/* ... */]; The assignment operator is somethin...
Naivete asked 7/2, 2015 at 11:1

1

Solved

I am working in an Android project which has many flavors, I used this code in build.gradle to set the package name for each flavor: flavorDimensions "type", "feature" productFlavors { abc { fla...
Racemose asked 3/2, 2015 at 12:50

4

Is there a decent open-source C library for storing and manipulating dynamically-typed variables (a.k.a. variants)? I'm primarily interested in atomic values (int8, int16, int32, uint, strings, blo...
Mukden asked 29/4, 2010 at 4:42

4

Solved

What is equivalent of the VARIANT datatype of C++ in C#? I have code in C++ which uses the VARIANT datatype. How can I convert that code in C#?
Pneumatograph asked 4/4, 2013 at 8:59

1

Solved

boost::variant seems a powerful container to manipulate a heterogeneous set of types. I am wondering its cost. In memory, I think it takes up the size of the largest type plus an integer representi...
Aneroidograph asked 2/10, 2014 at 2:42

© 2022 - 2024 — McMap. All rights reserved.