assignment-operator Questions
4
Solved
The documentation for PL/pgSQL says, that declaration and assignment to variables is done with :=.
But a simple, shorter and more modern (see footnote) = seems to work as expected:
CREATE OR REP...
Resign asked 18/9, 2011 at 15:2
3
Solved
I'm studying data structures (List, Stack, Queue), and this part of code is confusing me.
ListNode( const Object& theElement = Object(), ListNode * node = NULL);
template<class Object>...
Sammysamoan asked 11/4, 2012 at 10:45
3
Solved
$a = 1;
$a OR $a = 'somthing'
echo $a; //1
Why? If = have much precedence then 'OR' then why OR execute first?
Xeres asked 6/2, 2014 at 7:37
3
Solved
This is a question I've been mildly irritated about for some time and just never got around to search the answer to.
However I thought I might at least ask the question and perhaps someone can exp...
Roseleeroselia asked 20/11, 2013 at 9:19
1
Solved
This code fails to compile with gcc 4.8.2 (-std=c++11) but compiles with clang 3.4 (trunk) (-std=c++11):
#include <type_traits>
#include <vector>
struct X {
X& operator=(X&&a...
Kolo asked 16/12, 2013 at 12:10
2
Solved
I know I can use the comma operator like this
for (int i = 1, j = 15; j>10; i++, j--) {
// do something neat
}
but some articles seem to suggest that the comma operator can be used outside o...
Heterocyclic asked 26/9, 2012 at 12:19
2
Solved
I am trying to copy a 2d array into another like so:
reg [11:0] input_matrix [0:array_width - 1] [0:array_height - 1];
reg [11:0] output_matrix [0:array_width - 1] [0:array_height - 1];
always @(...
Underthecounter asked 27/11, 2013 at 23:11
2
Solved
Example:
A myfunction() { return A(); }
A a = myfunction(); // default ctor only (return value optimization)
a = myfunction(); // default ctor and operator=
Why can't the compiler just write the...
Risk asked 27/11, 2013 at 18:14
1
Solved
vector (as well as list and other containers) has a member function (MF) assign.
I want to compare the assign MF (range version) vs. the assignment operator.
As far as I understand it is useful to...
Overtake asked 1/11, 2013 at 21:6
1
Solved
I am new to JAVA programming.
I have read it in my book
String a="Hello";
String b="Hello";
System.out.println(a==b);
This should return false as a & b refer to different instances of String...
Gunflint asked 6/10, 2013 at 16:1
1
Solved
When defining an assignment operator, it invariably looks like this:
class X {...};
X& X::operator=(...whatever...);
That is, it has the return type "reference to X". Here, parameters (...w...
Kinder asked 30/9, 2013 at 8:48
1
Solved
I was looking through some code I wrote a while ago and realized I made an assumption about the assignment operator in C#. Here is the line of code in question (it works as expected):
pointsChecke...
Gentlefolk asked 15/9, 2013 at 18:10
1
Solved
I have seen it said that a operator= written to take a parameter of the same type by-value serves as both copy assignment operator and move assignment operator in C++11:
Foo& operator=(Foo f)
...
Floorage asked 18/8, 2013 at 20:22
1
Solved
int a[10];
int b[10];
a = b;
//
struct test {
int a[10];
};
test a,b;
a = b;
First code doesn't compile, since we cant assign array, but the second does. Isn't the default assignment operato...
Imbecilic asked 8/8, 2013 at 6:34
4
Solved
eg, it puzzles me:
struct A {
// some fileds...
char buf[SIZE];
};
A a;
a = a;
Through A's field buf, it looks like probably that the default assign operation will call something like memcpy t...
Jamesy asked 6/8, 2013 at 12:9
2
Solved
I am learning c. I have a question. Why doesn't my program work?
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
char cmd;
void exec()
{
if (cmd == "e")
{
printf("%c...
Valorie asked 20/7, 2013 at 21:14
1
Solved
My understanding about c++ implicit copy constructor is similar to
T(T const& x) :
base1(x), base2(x) ... ,
var1(x.var1), var2(x.var2)...
{}
Move constructor, copy & move assignment ...
Sign asked 18/7, 2013 at 6:49
3
In c++ when classes contains dynamically allocated data it is usually reasonable to explicitly define copy constructor, operator= and destructor. But the activity of these special methods overlaps....
Skindeep asked 10/7, 2013 at 9:59
1
Solved
I'm using data.table (1.8.9) and the := operator to update the values in one table from the values in another. The table to be updated (dt1) has many factor columns, and the table with the updates ...
Preter asked 9/7, 2013 at 1:37
3
Solved
Take this example code:
int a = 10;
int b = 20;
int c = 30;
int & foo1() {
qDebug() << "foo1" << endl;
return a;
}
int & foo2() {
qDebug() << "foo2" << endl;
...
Arundell asked 24/6, 2013 at 14:45
2
Solved
The following code compiles without problem on gcc 4.8.1:
#include <utility>
struct foo
{
};
int main()
{
foo bar;
foo() = bar;
foo() = std::move( bar );
}
It seems the implicitly ge...
Epicycle asked 8/6, 2013 at 2:34
3
Solved
As the title describes, what's the proper way to do an or-assignment (eg a= b || c) in shell scripting, specifically csh vs bash? I cannot test this, so perhaps the example above works.
I thought...
Shawnshawna asked 2/6, 2013 at 0:13
2
Solved
Consider the following 2 programs prog1 and prog2.Here if I try to change the value of the const qualified variable i using a pointer ptr,I get the warning (not error) "initialization discards...
Marvismarwin asked 14/5, 2013 at 12:12
2
Solved
I have written a code, for dynamically allocating a name. I know I should take care of deep copy in such scenarios. What I have written is my own version of Copy Constructor,Copy Assignment Operato...
Goggler asked 7/5, 2013 at 12:24
2
Solved
I learnt that i+=2 is the short-hand of i=i+2. But now am doubting it.
For the following code, the above knowledge holds no good:
byte b=0;
b=b+2; //Error:Required byte, Found int
The above c...
Meltage asked 3/5, 2013 at 15:3
© 2022 - 2024 — McMap. All rights reserved.