reference

Visual Studio Reference Not Being Copied Over In Multiple Project Environment

删除回忆录丶 提交于 2019-12-23 09:55:38
问题 I have a solution file in VS 2010 and it has multiple projects in it. Now, I have a reference to this dll call MySql.Data.Entity.dll. As an example, I have the following projects setup in the solution: Domain (reference to MySql.Data.Entity.dll) Domain.Test (reference to the project "Domain") I want that Domain.Test to copy over all the references from Domain, so I set the Property on that dll to "Copy Local - True". It did not copy over to the Domain.Test project. I have encounter this

Create a reference to a variable (similar to PHP's “=&”)?

夙愿已清 提交于 2019-12-23 09:55:07
问题 In PHP one can create a reference variable, so that two named variables can look at the same value: $a = 1; $b =& $a; echo $a; // 1 echo $b; // 1 $b = 2; echo $a; // 2 I'm looking to achieve something similar in Python. Specifically, I want to create a reference to an object's property, eg: class Foo(object): @property def bar(self): return some_calculated_value foo_instance = Foo() ref = foo_instance.bar # so that 'ref' is referencing the bar property on foo, calculated when used. Is this

size of an object reference in Javascript V8

余生颓废 提交于 2019-12-23 09:47:42
问题 Does anyone know the size of an object reference in Javascript (V8). It's 8 bytes like in C pointers? Thank you very much. 回答1: Yes, as I remember it takes 8 bytes. Nowadays it's the optimal size in x64 systems for all pointers/references. 来源: https://stackoverflow.com/questions/32538685/size-of-an-object-reference-in-javascript-v8

How to return “not found” when return value is const reference

强颜欢笑 提交于 2019-12-23 09:09:05
问题 I have a problem that when I use something like this: const MyList& my_list = getListForThisRegion(/*region ID, ...*/); I dont know what to return when no value is found. My problem is that I would like to have a way to signal (when returning value from getListForThisRegion ) "value not found" to the caller. If I was returning a pointer, I could return nullptr , but I don't know how to do it with references. All I can think of is having some static member not_found of type MyList , and

Referring to Code in IBM.Data.DB2 makes that Assembly Unavailable to the rest of my Solution

被刻印的时光 ゝ 提交于 2019-12-23 08:47:17
问题 I have a C# console application with three assemblies: Main , Common and Utilities . In a file in the Main assembly, Main.cs , I have the line: using Utilities; In a directory within the Common assembly, I have the DLL IBM.Data.DB2.dll . In the Utilities assembly, I have a source module which accesses said dll . Utilities have a Reference to IBM.Data.DB2 . In a source file within this assembly, Util.cs , I have the line: using IBM.Data.DB2; If, within a method in this file, I make any

C++ Storing references to values in std::map

旧街凉风 提交于 2019-12-23 08:44:07
问题 Am I right in assuming that adding/removing elements to an std::map does not effect the other elements (ie cause them to be relocated in memory) and so that the following is safe: I looked at various sites with info on the container but only found out about the cases where iterators are invalidated, which I already know... std::map<std::string,std::string> map; PopulateMap(map); std::string &a= map["x"]; AddMoreData(map); RemoveRandomKeysExceptX(map); map["x"] = "foo"; std::cout << a << " " <

Why use an immutable reference to i32

99封情书 提交于 2019-12-23 08:39:27
问题 In the chapter Lifetimes of the Rust book, there's an example: struct Foo<'a> { x: &'a i32, } fn main() { let y = &5; // this is the same as `let _y = 5; let y = &_y;` let f = Foo { x: y }; println!("{}", f.x); } Why do they use x: &'a i32 ? I think if it is just x: i32 then they cannot demonstrate the lifetime usage. However, is there any other reason behind it? Is there any production code that uses immutable reference to a primitive type like i32? 回答1: In this particular case the reason is

AngularJS - ReferenceError: $ is not defined

百般思念 提交于 2019-12-23 08:38:10
问题 I'm getting the following error when I try to do this var fbcanvas = $('#fbcanvas'); This is the error I got ReferenceError: $ is not defined This is my JS code var feedbackModule = angular.module('feedbackModule', [ 'ui.bootstrap', 'dialogs' ]); feedbackModule.controller('feedbackDialog', function($scope, $rootScope, $timeout, $dialogs) { $scope.confirmed = 'You have yet to be confirmed!'; $scope.name = '"Your name here."'; $scope.sendFeedback = function() { html2canvas(document.body, {

C++ const lvalue references

偶尔善良 提交于 2019-12-23 07:59:14
问题 Assuming I have: class A which is non-copyable class B which has as a member, const A& a (and takes an A in its constructer and sets it in its initialization list) a function A GenerateA(); Does this mean that it should be valid to do: B(GenerateA()) ? i.e, does the const ref mean that no copy of the A that generateA() returns is done? And does that mean that the scope of the returned temporary is extended for as long as B exists? EDIT: Addon question from the comments: Is it acceptable to

How can I create an iterator of &T from either a &Vec<T> or Vec<&T>?

徘徊边缘 提交于 2019-12-23 07:58:04
问题 I have an enum with two variants. Either it contains a reference to a Vec of String s or it contains a Vec of references to String s: enum Foo<'a> { Owned(&'a Vec<String>), Refs(Vec<&'a String>), } I want to iterate over references to the String s in this enum. I tried to implement a method on Foo , but don't know how to make it return the right iterator: impl<'a> Foo<'a> { fn get_items(&self) -> Iter<'a, String> { match self { Foo::Owned(v) => v.into_iter(), Foo::Refs(v) => /* what to put