mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 07:33:57 +00:00
add missing spaces after //
in c++
This commit is contained in:
parent
e0d8d2ab09
commit
6c4a7afacc
@ -78,7 +78,7 @@ int* ip = nullptr;
|
|||||||
// The C++ standard version:
|
// The C++ standard version:
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
//The C standard version:
|
// The C standard version:
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@ -257,7 +257,7 @@ fooRef = bar;
|
|||||||
cout << &fooRef << endl; //Still prints the address of foo
|
cout << &fooRef << endl; //Still prints the address of foo
|
||||||
cout << fooRef; // Prints "I am bar"
|
cout << fooRef; // Prints "I am bar"
|
||||||
|
|
||||||
//The address of fooRef remains the same, i.e. it is still referring to foo.
|
// The address of fooRef remains the same, i.e. it is still referring to foo.
|
||||||
|
|
||||||
|
|
||||||
const string& barRef = bar; // Create a const reference to bar.
|
const string& barRef = bar; // Create a const reference to bar.
|
||||||
@ -822,8 +822,8 @@ struct compareFunction {
|
|||||||
return a.j < b.j;
|
return a.j < b.j;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//this isn't allowed (although it can vary depending on compiler)
|
// this isn't allowed (although it can vary depending on compiler)
|
||||||
//std::map<Foo, int> fooMap;
|
// std::map<Foo, int> fooMap;
|
||||||
std::map<Foo, int, compareFunction> fooMap;
|
std::map<Foo, int, compareFunction> fooMap;
|
||||||
fooMap[Foo(1)] = 1;
|
fooMap[Foo(1)] = 1;
|
||||||
fooMap.find(Foo(1)); //true
|
fooMap.find(Foo(1)); //true
|
||||||
|
Loading…
Reference in New Issue
Block a user