variant

Inno Setup: Iterate through array of type Variant (from OleObject)

*爱你&永不变心* 提交于 2019-11-28 06:25:34
问题 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('IIsCompressionScheme', 'localhost/W3SVC/Filters/Compression/deflate'); Arr := Compr.HcScriptFileExtensions; { ... [code to iterate and add items] here ... } Compr.SetInfo(); The metabase editor calls the object type I'm trying to access a "multi-string". VarType(Arr) yields 0x200C as type (see http://www.jrsoftware

Can't use c++17 features using g++ 7.2 in QtCreator

北战南征 提交于 2019-11-28 02:30:32
问题 I have recently updated gcc and g++ to version 7.2. I would like to try out std::experimental::any and std::variant in particular, and I am using Qt 5.9.1 in QtCreator. So far I have written this in the project file: CONFIG += c++17 And I have added the correct headers in the correct places: #include <variant> #include <experimental/any> Any works fine, no problems there. However, when I include the variant header file, I get this error: /usr/include/c++/7/bits/c++17_warning.h:32: error:

How do I represent an Optional String in Go?

浪子不回头ぞ 提交于 2019-11-28 01:53:13
I wish to model a value which can have two possible forms: absent, or a string. The natural way to do this is with Maybe String , or Optional<String> , or string option , etc. However, Go does not have variant types like this. I then thought, following Java, C, etc., that the alternative would be nullability, or nil in Go. However, nil is not a member of the string type in Go. Searching, I then thought to use the type *string . This could work, but seems very awkward (e.g. I cannot take the address of the string literal in the same way that I can take the address of a struct literal). What is

What are the differences between std::variant and boost::variant?

大城市里の小女人 提交于 2019-11-28 00:45:01
In an answer to this SO question: What is the equivalent of boost::variant in the C++ standard library? it is mentioned that boost::variant and std::variant differ somewhat. What are the differences, as far as someone using these classes is concerned? What motivation did the committee express to adopt std::variant with these differences? What should I watch out for when coding with either of these, to maintain maximum compatibility with switching to the other one? (the motivation is using boost::variant in pre-C++17 code) Assignment/emplacement behavior: boost::variant may allocate memory when

C++ Variant

梦想的初衷 提交于 2019-11-27 20:36:00
I'm in the process of creating a class that stores metadata about a particular data source. The metadata is structured in a tree, very similar to how XML is structured. The metadata values can be integer, decimal, or string values. I'm curious if there is a good way in C++ to store variant data for a situation like this. I'd like for the variant to use standard libraries, so I'm avoiding the COM, Ole, and SQL VARIANT types that are available. My current solution looks something like this: enum MetaValueType { MetaChar, MetaString, MetaShort, MetaInt, MetaFloat, MetaDouble }; union MetaUnion {

Variable iterating on itself - different behavior with different types

心已入冬 提交于 2019-11-27 20:28:41
问题 Please take a look at the latest updates at the end of the post. In Particular, see Update 4: the Variant comparison Curse I’ve already seen mates banging their head against the wall to understand how a variant works, but never imagined that I will have my own bad moment with it. I have successfully used the following VBA construction: For i = 1 to i This works perfectly when i is an Integer or any numeric type, iterating from 1 to the original value of i . I do this on occasions where i is a

How to pass SAFEARRAY to COM object through IDispatch?

二次信任 提交于 2019-11-27 18:36:28
问题 i am trying to call a method of COM object, where one of the documented parameters is an "array of bytes ". The actual declartion depends on the per-language documentation you're looking at: in C# language: byte[] TransformFinalBlock( byte[] inputBuffer, int inputOffset, int inputCount ) in C++ language; array<unsigned char>^ TransformFinalBlock( array<unsigned char>^ inputBuffer, int inputOffset, int inputCount ) in VB language: Function TransformFinalBlock ( _ inputBuffer As Byte(), _

Can't stream std::endl with overloaded operator<<() for std::variant

喜欢而已 提交于 2019-11-27 12:54:28
问题 This answer describes how to stream a standalone std::variant . However, it doesn't seem to work when std::variant is stored in a std::unordered_map . The following example: #include <iostream> #include <string> #include <variant> #include <complex> #include <unordered_map> // https://stackoverflow.com/a/46893057/8414561 template<typename... Ts> std::ostream& operator<<(std::ostream& os, const std::variant<Ts...>& v) { std::visit([&os](auto&& arg) { os << arg; }, v); return os; } int main() {

What's the difference between <h:head> and <head> in Java Facelets?

我们两清 提交于 2019-11-27 09:16:16
See this . When and why to use <h:head> , instead of <head> ? I've seen Primefaces won't work with <head> , though. The <head> tag is a HTML tag , which defines the head of the HTML page (this is where you define metadata, or include the resources such as JavaScript or CSS for example). The <h:head> is a JSF tag (introduced with JSF 2.0) that handles the <head> part of your page. The interest of having such JSF tag is that this head becomes part of your JSF components tree, and thus, you can manipulate it in your Java code. Regarding the <head> incompatibility with Primefaces, I don't see why

How to pass an array of bytes reference to a COM object method

走远了吗. 提交于 2019-11-27 07:33:39
问题 In PHP, I want to pass an array of bytes reference to a COM object method whose syntax in VB is: object.VBObjectMethod(ByRef aRawData() As Byte) where parameter aRawData is an array of bytes that specifies a data object. In PHP I am initialising the COM class and calling VBObjectMethod as follows: $theObject = new COM("VBObject.Class") or die ("Could not initialise VBObjectClass"); Up to this bit things are OK but I have no idea how to do the following correctly: $theObject->VBObjectMethod(