reference

dereferencing in a vector of pointers to objects

I'm trying to access the object (called a Vector) pointed to by a pointer held in a vector container, but I can't seem to get to it. Here are the important code snippets: int main{ Vector<double>* test = new Vector<double>(randvec<double>()); test->save(); cout << Element::vectors[0]; return 0; } Where Vector is a templ...

const reference to temporary oddity

We all know that things like this are valid in c++: const T &x = T(); while: T &x = T(); is not. In a recent question the conversation lead to this rule. The OP had posted some code which clearly evokes UB. But I would have expect a modified version of it to work (This is the modified version): #include <iostream> using namespace...

If Unity is not in the GAC, how does VS know to show it in Add References?

I'm trying to index the GAC and use the ResolveAssemblyReferences target. However, some assemblies (such as Unity application block) seem to be missing from the GAC and yet VS happily shows them in the Add Reference dialog. My question: how can this be? I always thought that only GAC-registered assemblies appear there. Am I missing somet...

Vocabulary: path in a graph of objects?

Hi. I'm having trouble with the following sentence: DeepClone performs a deep clone of the target object, stopping the cloning process when all <dependency paths> have reached a value type or an ITransactionalObject. What I mean by "dependency path" is the chain of references you follow in the cloning process: object A has a ...

Assembly Reference in Loose XAML

I have scenario where my loose xaml file can contain the custom control from another assembly. How do i make a reference to that assembly. My Loose XAML and assembly are at the same path. I know the embedded xaml or xaml with in a project, the reference is added like this: xmlns:WpfToolKit="http://schemas.microsoft.com/wpf/2008/toolkit"...

How to "unlink" a Perl array reference from the referenced variable?

In Perl 5.10.1: #!/usr/bin/perl my @a = (1, 2, 3); my $b = \@a; print join('', @{$b}) . "\n"; @a = (6, 7, 8); print join('', @{$b}) . "\n"; This prints 123 then 678. However, I'd like to get 123 both times (i.e. reassigning the value of @a will not change the array that $b references). How can I do this? ...

reference variables in c++

this might be silly!!! but i am eager to know about it:) why are reference variables not present/used in C? why are they designed for C++? ...

Why is calling a function (such as strlen, count etc) on a referenced value so slow?

I've just found something very strange in PHP. If I pass in a variable to a function by reference, and then call a function on it, it's incredibly slow. If you loop over the inner function call and the variable is large it can be many orders of magnitude slower than if the variable is passed by value. Example: <?php function TestCoun...

Why does my WCF Service generate Array types when I explicitly set it to List????

I have been consuming a service for some time in development, and have been updating my service reference almost daily with no problems. Collection types have been set to generate as System.Collections.Generic.List in the Advanced options. However, for no apparent reason, now when I update the Service Reference, it's generating Array ty...

WCF Service Reference generates its own contract interface, won't reuse mine!

Hi, my first question so hope it is suitable - Shared interface assembly - I have a 'shared' assembly which has an interface, let's call it IDocRepository. It's marked with [ServiceContract] and there are several [OperationContract]-marked methods. WCF implementation assemblies - I have two WCF service projects, each referencing the s...

understanding references usage

i thought, that i understand what references do. but now i meet an example, which can't understand anyway. i saw an interesting script here, but why he use & in this script i can't understand. here is the part of script foreach ($nodeList as $nodeId => &$node) { if (!$node['id_parrent'] || !array_key_exists($node['id_parrent'], $n...

ptr_map and pointer

Hello, I'm using ptr_map from boost for storing objects derived from some base abstract type. class Entity { virtual void foo() = 0; }; class Entity1 : public Entity {}; class Entity2 : public Entity {}; boost::ptr_map<string, Entity> someMap; // We could store pointers for abstract type Inserting works great: someMap.insert("someKe...

Reference to a pointer

char *str = "Hello"; char *ptr = str; char *&rptr = str; What is the difference between ptr and rptr? I understand rptr is a reference to a pointer(in theory) but how does it differ in terms of implementation with ptr? Are references in C++ implemented using pointers? ...

casting pointers

Hello, I'm using ptr_map for storing different types of pointers. boost::ptr_map<string, any> someMap; I store there some templated class objects: someMap.insert("1", new SomeClass<int>()); someMap.insert("2", new SomeClass<float>()); Now I want to get values from map. Here is a sample with references: template<typename T> T &get(...

PHP: check if object/array is a reference

Sorry to ask, its late and I can't figure a way to do it... anyone can help? $users = array( array( "name" => "John", "age" => "20" ), array( "name" => "Betty", "age" => "22" ) ); $room = array( "furniture" => array("table","bed","chair"), "objects" => array("tv","radio","bo...

Why create a folder in your project to hold dlls you're referencing anyway?

I'm working through installing the N2 content management framework in an ASP.NET website project. The instructions at http://n2cms.com/Documentation/Content-enabling%20an%20existing%20site/The%20first%20content%20class.aspx recommend I create a lib folder to hold the required dlls. The very next step asks me to reference those same dlls...

reference variable array

Hi, i used always $text = $datasql[0]; where $datasql = array('0'=>array('some'=>'text', 'some2'=>'text2'), '1'=>$data, etc...); and found work costruction $datasql = &$datasql[0]; and work, why? That really reference?? and how remeber php in memory this solution. Thanks for reaply ...

When does a param that is passed by reference get updated?

Suppose I have a method like this: public void MyCoolMethod(ref bool scannerEnabled) { try { CallDangerousMethod(); } catch (FormatException exp) { try { //Disable scanner before validation. scannerEnabled = false; if (exp.Message == "FormatException") ...

WPF : Referencing Assembly with Forms Controls does not work ?

Hi guys I've got a Problem. I need to use some classes from another Library DLL, that has been written a year ago, in my WPF Project. Therefore I reference this Library in my Project. But when I want to rebuild my solution I always get some warnings that my assembly cannot be resolved because it uses some dependencys that do not match m...

question about entity

i have such code var menu = _dataManager.Menu.Details(id); var menu2 = _dataManager.Menu.Details(id); menu.Name = "AAA"; in this case menu2.Name will be "AAA", i guess it because of reference, but how can i solve it? ...