Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
3 votes
3 answers
201 views

This question arouse from the question "why is const in function return type, which is a const pointer, ignored?" (const pointer, not pointer to const) int* const Foo(); is identical to int*...
5 votes
2 answers
318 views

In C++, a function with signature void f(A& a) (non-template) only binds to a lvalue. Is it possible for an rvalue to automatically cast itself to an lvalue? This is what I tried: #include <...
alfC's user avatar
  • 16.8k
13 votes
5 answers
2k views

I’m working on understanding pointers in C by breaking down the language into three key areas: syntax, semantics, and idioms. To grasp pointers, I’ve been focusing on fundamental concepts: what’s an ...
4 votes
1 answer
79 views

Ok this might be a bit difficult to explain: I want to call a function hello that has an overload for either an rvalue or an lvalue ref of type Json. This Json object is converted from a JsonKey using ...
4 votes
1 answer
109 views

In C++, a named rvalue reference is lvalue. Why the below code yields "error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'"? int & unmove(int &...
zwhconst's user avatar
  • 1,657
1 vote
2 answers
158 views

I was reading C Notes for Professionals, in which, it claims that Compound Literals can only be lvalues. But LLMs have mixed answers upon that stating it could depend upon the context and could be ...
2 votes
1 answer
107 views

I was doing Leetcode when I stumbled upon this interesting technique. Here it is in short: #include <iostream> #include <vector> void print(std::vector<int>& vec) { for (int ...
Aik's user avatar
  • 65
27 votes
3 answers
5k views

Some time ago I stumbled upon the idea of how a C construct, such as (expr0, expr1, expr2), evaluates (see "What does the comma operator , do?" for more context). I've started experimenting ...
1 vote
1 answer
227 views

Hi I have a quick question - over here it says ranged-based for loops of the form for ( init-statement (optional) range-declaration : range-expression ) are equivalent to the code: { auto &&...
1 vote
2 answers
84 views

#include <stdio.h> #include <stdlib.h> typedef struct { int *array; int size; }Array; Array array_create(int init_size); int* array_at(Array *,int index); void ...
2 votes
1 answer
76 views

I'm having trouble using a Perl subroutine reference as an lvalue. Am I doing something wrong here, or is it not possible to do this? I'm using ActiveState Perl 5.20 on Windows. package Warning { ...
-2 votes
2 answers
1k views

I had a queue and originally worked with strings and now I added templates to it so that if I decide to add int doubles, etc, it would still work. When using strings to add to my queue, I get an error ...
0 votes
1 answer
147 views

This is a code test from this. I reproduced some of them as below: //struct definition. All kinds of prints struct Snitch { // Note: All methods have side effects Snitch() { cout << "c'...
Wason's user avatar
  • 1,553
1 vote
0 answers
56 views

I'm reading the ISO C99 Standard and this example of a modifiable lvalue object: *errno() blew me away. Please could you tell me if this possible implementation of errno is ISO C99 compliant? int * ...
Sam's user avatar
  • 119
0 votes
2 answers
158 views

Need to understand and figure out how to work efficiently with these 2 definitions on lowlevel. void func(const T& foo) { T bar = foo; } // Lets overload this void func(T&& foo) { ...
Omrum Cetin's user avatar
  • 1,489

15 30 50 per page
1
2 3 4 5
...
45

AltStyle によって変換されたページ (->オリジナル) /