mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-12 09:44:24 +02:00
Update c++.html.markdown
Just forcing http:// links to be https:// when possible. I also read everything carefully and didn't find any mistake or easy improvements I could add (but I'm not that familiar with C++)
This commit is contained in:
@@ -2,16 +2,16 @@
|
|||||||
language: c++
|
language: c++
|
||||||
filename: learncpp.cpp
|
filename: learncpp.cpp
|
||||||
contributors:
|
contributors:
|
||||||
- ["Steven Basart", "http://github.com/xksteven"]
|
- ["Steven Basart", "https://github.com/xksteven"]
|
||||||
- ["Matt Kline", "https://github.com/mrkline"]
|
- ["Matt Kline", "https://github.com/mrkline"]
|
||||||
- ["Geoff Liu", "http://geoffliu.me"]
|
- ["Geoff Liu", "http://geoffliu.me"]
|
||||||
- ["Connor Waters", "http://github.com/connorwaters"]
|
- ["Connor Waters", "https://github.com/connorwaters"]
|
||||||
- ["Ankush Goyal", "http://github.com/ankushg07"]
|
- ["Ankush Goyal", "https://github.com/ankushg07"]
|
||||||
- ["Jatin Dhankhar", "https://github.com/jatindhankhar"]
|
- ["Jatin Dhankhar", "https://github.com/jatindhankhar"]
|
||||||
---
|
---
|
||||||
|
|
||||||
C++ is a systems programming language that,
|
C++ is a systems programming language that,
|
||||||
[according to its inventor Bjarne Stroustrup](http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Keynote),
|
[according to its inventor Bjarne Stroustrup](https://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Keynote),
|
||||||
was designed to
|
was designed to
|
||||||
|
|
||||||
- be a "better C"
|
- be a "better C"
|
||||||
@@ -37,7 +37,7 @@ one of the most widely-used programming languages.
|
|||||||
// Just like in C, your program's entry point is a function called
|
// Just like in C, your program's entry point is a function called
|
||||||
// main with an integer return type.
|
// main with an integer return type.
|
||||||
// This value serves as the program's exit status.
|
// This value serves as the program's exit status.
|
||||||
// See http://en.wikipedia.org/wiki/Exit_status for more information.
|
// See https://en.wikipedia.org/wiki/Exit_status for more information.
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
// Command line arguments are passed in by argc and argv in the same way
|
// Command line arguments are passed in by argc and argv in the same way
|
||||||
@@ -483,7 +483,7 @@ public:
|
|||||||
void setOwner(const std::string& dogsOwner);
|
void setOwner(const std::string& dogsOwner);
|
||||||
|
|
||||||
// Override the behavior of the print function for all OwnedDogs. See
|
// Override the behavior of the print function for all OwnedDogs. See
|
||||||
// http://en.wikipedia.org/wiki/Polymorphism_(computer_science)#Subtyping
|
// https://en.wikipedia.org/wiki/Polymorphism_(computer_science)#Subtyping
|
||||||
// for a more general introduction if you are unfamiliar with
|
// for a more general introduction if you are unfamiliar with
|
||||||
// subtype polymorphism.
|
// subtype polymorphism.
|
||||||
// The override keyword is optional but makes sure you are actually
|
// The override keyword is optional but makes sure you are actually
|
||||||
@@ -616,7 +616,7 @@ boxOfBox.insert(intBox);
|
|||||||
// template<typename T>
|
// template<typename T>
|
||||||
// instead. The 'class' keyword and 'typename' keywords are _mostly_
|
// instead. The 'class' keyword and 'typename' keywords are _mostly_
|
||||||
// interchangeable in this case. For the full explanation, see
|
// interchangeable in this case. For the full explanation, see
|
||||||
// http://en.wikipedia.org/wiki/Typename
|
// https://en.wikipedia.org/wiki/Typename
|
||||||
// (yes, that keyword has its own Wikipedia page).
|
// (yes, that keyword has its own Wikipedia page).
|
||||||
|
|
||||||
// Similarly, a template function:
|
// Similarly, a template function:
|
||||||
@@ -660,7 +660,7 @@ printMessage<10>(); // Prints "Learn C++ faster in only 10 minutes!"
|
|||||||
/////////////////////
|
/////////////////////
|
||||||
|
|
||||||
// The standard library provides a few exception types
|
// The standard library provides a few exception types
|
||||||
// (see http://en.cppreference.com/w/cpp/error/exception)
|
// (see https://en.cppreference.com/w/cpp/error/exception)
|
||||||
// but any type can be thrown as an exception
|
// but any type can be thrown as an exception
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@@ -1030,7 +1030,7 @@ sort(dog_ids.begin(), dog_ids.end(), [&weight](const int &lhs, const int &rhs) {
|
|||||||
return weight[lhs] < weight[rhs];
|
return weight[lhs] < weight[rhs];
|
||||||
});
|
});
|
||||||
// Note we captured "weight" by reference in the above example.
|
// Note we captured "weight" by reference in the above example.
|
||||||
// More on Lambdas in C++ : http://stackoverflow.com/questions/7627098/what-is-a-lambda-expression-in-c11
|
// More on Lambdas in C++ : https://stackoverflow.com/questions/7627098/what-is-a-lambda-expression-in-c11
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// Range For (C++11 and above)
|
// Range For (C++11 and above)
|
||||||
@@ -1106,7 +1106,8 @@ f1 = f2;
|
|||||||
|
|
||||||
#include<tuple>
|
#include<tuple>
|
||||||
|
|
||||||
// Conceptually, Tuples are similar to old data structures (C-like structs) but instead of having named data members,
|
// Conceptually, Tuples are similar to old data structures (C-like structs)
|
||||||
|
// but instead of having named data members,
|
||||||
// its elements are accessed by their order in the tuple.
|
// its elements are accessed by their order in the tuple.
|
||||||
|
|
||||||
// We start with constructing a tuple.
|
// We start with constructing a tuple.
|
||||||
|
Reference in New Issue
Block a user