Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 66 additions & 66 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
# AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: No
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: true
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
# AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: No
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: true
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never
78 changes: 39 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# rust-clippy is a tool that runs a bunch of lints to catch common
# mistakes in your Rust code and help improve your Rust code.
# More details at https://github.com/rust-lang/rust-clippy
# and https://rust-lang.github.io/rust-clippy/

name: CI

on:
pull_request:
push:
paths-ignore:
- '**.md'
- 'LICENSE'

jobs:
rust-clippy-analyze:
name: Run xmake build
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest

- name: Build
run: xmake

- name: Summary
run: xmake run summary
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# rust-clippy is a tool that runs a bunch of lints to catch common
# mistakes in your Rust code and help improve your Rust code.
# More details at https://github.com/rust-lang/rust-clippy
# and https://rust-lang.github.io/rust-clippy/
name: CI
on:
pull_request:
push:
paths-ignore:
- '**.md'
- 'LICENSE'
jobs:
rust-clippy-analyze:
name: Run xmake build
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
- name: Build
run: xmake
- name: Summary
run: xmake run summary
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/build/

/log/*
!/log/placeholder

.*/
!/.github/
/build/
/log/*
!/log/placeholder
.*/
!/.github/
18 changes: 9 additions & 9 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
The MIT License (MIT)

Copyright © 2024 YdrMaster

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The MIT License (MIT)
Copyright © 2024 YdrMaster
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
136 changes: 68 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
# Learning C++

> **NOTICE** 推荐阅读 [C++ 参考手册](https://zh.cppreference.com/w/cpp) 学习 C/C++ 语法和 STL 库。

## 使用指南

1. 安装构建工具 [xmake](https://xmake.io/)

xmake 是跨平台的 C/C++ 构建系统,具有安装方便,配置简洁的优点。

安装方式见[中文官方文档](https://xmake.io/#/zh-cn/getting_started?id=%e5%ae%89%e8%a3%85)。

> **NOTICE** xmake 仅是构建工具,不包括工具链。仍需先安装 C/C++ 工具链(MSVC、GCC 或 Clang)才能开始使用项目。

> **NOTICE** 有报告称 xmake 在 Windows 上存在定位工具链失败的问题。因此推荐按下列规则选择学习平台:
>
> 1. 如果已经在默认位置安装 Visual Studio/Ms C++ Build Tools,则推荐原生 Windows 学习本项目;
> 2. 如果已经配置好 WSL2,则推荐 WSL2 + GCC/Clang 学习本项目;
> 3. 如果未配置过任何工具链,则推荐在默认位置安装 Visual Studio;
> 4. 不推荐 MinGW 或 Cygwin,除非足够熟悉这些环境,可以自行完成配置;

> **NOTICE** 如果仍遇到工具链问题,推荐浏览 [xmake issues](https://github.com/xmake-io/xmake/issues);

2. 克隆仓库

```shell
git clone https://github.com/LearningInfiniTensor/learning-cxx.git
```

3. 编译学习系统

```shell
cd learning-cxx
xmake
```

4. 开始学习

使用

```shell
xmake run learn <exercise number>
```

运行指定练习,例如:

```shell
xmake run learn 0
```

运行 0 号练习。

5. 总结学习

使用

```shell
xmake run summary
```

总结所有练习通过情况。

## 其他学习资源

- [Microsoft:欢迎回到 C++](https://learn.microsoft.com/zh-cn/cpp/cpp/welcome-back-to-cpp-modern-cpp?view=msvc-170)
- [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines)
- ~~[Google 风格指南(中文版)](https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/contents.html)~~(deprecated)
- [360 安全规则集合](https://github.com/Qihoo360/safe-rules)
# Learning C++
> **NOTICE** 推荐阅读 [C++ 参考手册](https://zh.cppreference.com/w/cpp) 学习 C/C++ 语法和 STL 库。
## 使用指南
1. 安装构建工具 [xmake](https://xmake.io/)
xmake 是跨平台的 C/C++ 构建系统,具有安装方便,配置简洁的优点。
安装方式见[中文官方文档](https://xmake.io/#/zh-cn/getting_started?id=%e5%ae%89%e8%a3%85)。
> **NOTICE** xmake 仅是构建工具,不包括工具链。仍需先安装 C/C++ 工具链(MSVC、GCC 或 Clang)才能开始使用项目。
> **NOTICE** 有报告称 xmake 在 Windows 上存在定位工具链失败的问题。因此推荐按下列规则选择学习平台:
>
> 1. 如果已经在默认位置安装 Visual Studio/Ms C++ Build Tools,则推荐原生 Windows 学习本项目;
> 2. 如果已经配置好 WSL2,则推荐 WSL2 + GCC/Clang 学习本项目;
> 3. 如果未配置过任何工具链,则推荐在默认位置安装 Visual Studio;
> 4. 不推荐 MinGW 或 Cygwin,除非足够熟悉这些环境,可以自行完成配置;
> **NOTICE** 如果仍遇到工具链问题,推荐浏览 [xmake issues](https://github.com/xmake-io/xmake/issues);
2. 克隆仓库
```shell
git clone https://github.com/LearningInfiniTensor/learning-cxx.git
```
3. 编译学习系统
```shell
cd learning-cxx
xmake
```
4. 开始学习
使用
```shell
xmake run learn <exercise number>
```
运行指定练习,例如:
```shell
xmake run learn 0
```
运行 0 号练习。
5. 总结学习
使用
```shell
xmake run summary
```
总结所有练习通过情况。
## 其他学习资源
- [Microsoft:欢迎回到 C++](https://learn.microsoft.com/zh-cn/cpp/cpp/welcome-back-to-cpp-modern-cpp?view=msvc-170)
- [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines)
- ~~[Google 风格指南(中文版)](https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/contents.html)~~(deprecated)
- [360 安全规则集合](https://github.com/Qihoo360/safe-rules)
Loading