const reference to a temporary object becomes broken after function scope (life time)

The lifetime-extension of a temporary object can be performed only once, when the temporary object gets bound to the first reference. After that, the knowledge that the reference refers to a temporary object is gone, so further lifetime extensions are not possible. The case that is puzzling you A const& refnop = A(a).nothing(); is similar … Read more

TFS Build server and COM references – does this work?

Using tlbimp.exe directly is not necessary. Try replacing any <COMReference> items in the project file with <COMFileReference>. An example would look like this: <ItemGroup> <COMFileReference Include=”MyComLibrary.dll”> <EmbedInteropTypes>True</EmbedInteropTypes> </COMFileReference> </ItemGroup> The COM dll doesn’t need to be registered on the machine for this to work. Each COMFileReference item can also have a WrapperTool attribute but the … Read more

In C#, why Equals() method on arrays only compare their references, not their actual content

Although Microsoft’s Framework classes are unfortunately a bit inconsistent with regard to what Object.Equals(Object) means, in general X.Equals(Y) will only be true if replacing arbitrary references to X with references to Y, and/or vice versa, would not be expected to alter the semantics of the objects in question. For example, if X is a String … Read more

Rust lifetime error expected concrete lifetime but found bound lifetime

Let’s compare the two definitions. First, the trait method: fn to_c<‘a>(&self, r: &’a Ref) -> Container<‘a>; And the implementation: fn to_c(&self, r: &’a Ref) -> Container<‘a>; See the difference? The latter doesn’t have <‘a>. <‘a> has been specified elsewhere; the fact that it has the same name does not matter: it is a different thing … Read more