5
$\begingroup$

On the left, I am "you".
On the right, I am "it".
On the forward, I am either "you" or "it".
What am I?

Subtle hint:

I myself is always on the left.

Moderate hint:

There are two kinds of "it".

Decisive hint:

And

$\endgroup$
11
  • $\begingroup$ is that a variable? $\endgroup$
    – rsonx
    Nov 3, 2019 at 6:50
  • $\begingroup$ @rsonx Yes, kind of. $\endgroup$ Nov 3, 2019 at 7:13
  • $\begingroup$ That is an if-else comparison. right? $\endgroup$
    – rsonx
    Nov 3, 2019 at 7:14
  • $\begingroup$ @rsonx Not in the language. $\endgroup$ Nov 3, 2019 at 7:18
  • $\begingroup$ What does forwardly means? This might be the branch prediction. $\endgroup$
    – rsonx
    Nov 3, 2019 at 7:22

8 Answers 8

4
+50
$\begingroup$

Ok, second attempt. You are a:

reference

On the left, I am "you".

Lvalue references refer to a live object, hence "you".

On the right, I am "it".

Rvalue references refer to a temporary object, hence "it".

On the forward, I am either "you" or "it".

Forwarding references can either be lvalue references or rvalue references.

Hints:

Hint 1:

I myself is always on the left.
References themselves are always lvalues.

Hint 2:

There are two kinds of "it".
Rvalues are further classified as prvalues or xvalues.

Hint 3:

And
References are declared like type& (lvalue reference), and type&& (rvalue reference).

$\endgroup$
5
  • $\begingroup$ Gah! Inaccurate explanation. rot13(Gur nafjre vf "ersrerapr", abg gur nqqerff-bs bcrengbe.) $\endgroup$ Nov 8, 2019 at 20:45
  • $\begingroup$ @DannyuNDos rot13(Gung jnf gur nafjre. Gur bayl ernfba "bcrengbe" vf gurer va cneragurfrf vf gung & nyfb unccraf gb unir gur anzr "ersrerapr bcrengbe", fb vg'f grpuavpnyyl nyfb ba gur yrsg/evtug) $\endgroup$
    – Avi
    Nov 8, 2019 at 20:48
  • $\begingroup$ rot13(V zrna V bayl vagraqrq gur ersrerapr glcr.) $\endgroup$ Nov 8, 2019 at 20:58
  • $\begingroup$ @DannyuNDos Ah, fair enough $\endgroup$
    – Avi
    Nov 8, 2019 at 20:59
  • $\begingroup$ Since your answer was the most accurate, I gave you the bounty. Your answer has been edited to the intended answer. $\endgroup$ Nov 13, 2019 at 0:32
3
$\begingroup$

I think you are

a boolean taking a value through the |= operator (in C++/Java)

As an example:

 boolean you = ...;
 boolean it = ...;
 you |= it; // you, depending on the values of you and it, is either you or it
 

On the left, I am "you".

you |= it;

On the right, I am "it".

you |= it;

Forwardly, I am either "you" or "it".

In C++/Java, the |= operator returns the value that was assigned, in this case you | it, i.e., you or it

$\endgroup$
3
  • $\begingroup$ But what exactly am "I"? If "I am you", then "On the right I am it" doesn't quite make sense, because on the right it is simply another variable. If "I am boolean", then I'd say it makes equal sense to say "I am int": just change all the boolean to int, and |= means bitwise or. $\endgroup$
    – WhatsUp
    Nov 3, 2019 at 17:23
  • $\begingroup$ @WhatsUp You're right, I'm not sure what it is then $\endgroup$
    – Avi
    Nov 3, 2019 at 17:27
  • $\begingroup$ rot13(Lbh tbg gur evtug ynathntr, ohg fbeel, gung'f vapbeerpg.) $\endgroup$ Nov 3, 2019 at 22:10
3
$\begingroup$

Are you

std::conditional?

Still trying to work out the hints.

Extra:

You said that C++ was the correct language in the comments under another answer.

[note: this answer has been through many changes, please see the edit history to reveal all the incorrect guesses that I made]

$\endgroup$
10
  • $\begingroup$ @DannyuNDos rot13(Vf vg gur greanel bcrengbe?) $\endgroup$
    – S.S. Anne
    Nov 4, 2019 at 16:35
  • $\begingroup$ This looks very much like the correct answer, especially with the comment "On the second thought, an if-else comparison is needed anyway." But for me it's a bit strange to say "on the left, I am you" while you is effectively "in the middle"... $\endgroup$
    – WhatsUp
    Nov 4, 2019 at 20:16
  • $\begingroup$ @WhatsUp Yeah, still trying to work that out. It may be that you is the condition. $\endgroup$
    – S.S. Anne
    Nov 4, 2019 at 20:18
  • $\begingroup$ Sorry, not the correct answer either. rot13(Gur ynathntr va punetr vf P++, abg Wnin.) $\endgroup$ Nov 4, 2019 at 21:31
  • 1
    $\begingroup$ Because there is a lower limit on the comment length. $\endgroup$ Nov 7, 2019 at 3:22
1
$\begingroup$

Are you

a Boolean set by a conditional statement?

Example:

int a = 7;
bool you = false; // set the boolean value to false
you = (a > 5); // “you” will be equal either to itself (still) or to the result of the comparison (the “it”)

$\endgroup$
1
  • $\begingroup$ rot13(Fbeel, gung'f vapbeerpg.) $\endgroup$ Nov 3, 2019 at 22:10
0
$\begingroup$

Maybe you are

a string (in an if-else or other conditional statement)

First of all,

"you" and "it" are in quotes

On the left, I am "you".

if(stringName === "you") { something happens }

On the right, I am "it".

else if(stringName === "it") { something else happens }

On the forward, I am either "you" or "it".

without the if-else statement (or any other conditional statement) the string could either be "you" or "it" and the action will still take place.

Hint

Declared as "you":
String stringName = "you";

$\endgroup$
1
  • $\begingroup$ Sadly, not the correct answer. $\endgroup$ Nov 4, 2019 at 10:50
0
$\begingroup$

Are you?

A varying iterator

On the left, I am "you".
On the right, I am "it".
On the forward, I am either "you" or "it".

A forward iterator between two fixed iterators begin() and end() is either pointing to an element in the range (which we can refer to as being of the type "you" as it is pointing to an object and calling it out -- imagine the pointer as someone literally pointing their finger and yelling "You!", "You!", "You!") or points to nothing (more specifically points to something outside the range i.e. points to nothing in particular) in which case it is simply an iterator (it). When performing forward iteration (from left to right), the varying iterator goes: you-you-...-you-it

$\endgroup$
1
  • $\begingroup$ Sadly, not the correct answer. $\endgroup$ Nov 5, 2019 at 3:43
0
$\begingroup$

You are

Condition


On the left, I am "you".

A variable declared by you.


On the right, I am "it".

A value that has something to do with the variable


On the forward, I am either "you" or "it".

you dont need to state condition when you use a function

$\endgroup$
1
  • $\begingroup$ Sadly, not the correct answer. $\endgroup$ Nov 6, 2019 at 20:30
0
$\begingroup$

Are you an

Iterator statement like

 this->it = *it;
Let's analyse this solution. On the left, I am "you". On the left of the arrow this references the current class (or you). On the right, I am "it". On the right of the arrow, it is the iterator variable. On the forward, I am either "you" or "it". By forward I am guessing you mean the forward iterator (or perhaps the forward arrow). Hint 1: I myself is always on the left. this is always on the left. Hint 2: There are two kinds of "it". One is it the other is *it. Hint 3: And. Not sure about this one... Or perhaps it is
this = this->it;

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.