Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
primitive type copy constructor
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include <cassert> #include <iostream> struct MyClass { int m = 0; }; MyClass& f(MyClass& x) { x.m++; return x; } inline MyClass f(MyClass&& x) { return f(x); } int& f(int& x) { x++; return x; } inline int f(int&& x) { return f(x); } int main() { MyClass x1; auto y1 = f(MyClass(x1)); // Result: x1.m = 0, y1.m = 1 int x2 = 0; auto y2 = f(int(x2)); // Result: x2 = 1, y2 = 1 std::cout << x1.m << x2; //assert(x1.m == x2); // FAILED!!! return 0; }
cl.exe
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 1.67 sec, absolute running time: 0.04 sec, absolute service time: 1.73 sec
fork mode
|
history
|
discussion
01
stackse - search stackoverflow differently