Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
2
2024ustc-jianmu-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
compiler_staff
2024ustc-jianmu-compiler
Commits
32c9fbfa
Commit
32c9fbfa
authored
Sep 02, 2024
by
刘睿博
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
final version
parent
623e0770
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
CMakeLists.txt
CMakeLists.txt
+2
-0
src/CMakeLists.txt
src/CMakeLists.txt
+1
-1
src/main.cpp
src/main.cpp
+18
-4
No files found.
CMakeLists.txt
View file @
32c9fbfa
...
...
@@ -3,6 +3,8 @@ project(stl_debug VERSION 0.1.0 LANGUAGES C CXX)
set
(
CMAKE_CXX_STANDARD 17
)
set
(
default_build_type
"Debug"
)
INCLUDE_DIRECTORIES
(
include
)
...
...
src/CMakeLists.txt
View file @
32c9fbfa
add_executable
(
stl_test
main.cpp Human.cpp Student.cpp logging.cpp
lab0_debug
main.cpp Human.cpp Student.cpp logging.cpp
)
\ No newline at end of file
src/main.cpp
View file @
32c9fbfa
#include <iostream>
#include <string>
#include <stdio.h>
#include "Human.hpp"
#include "Student.hpp"
...
...
@@ -11,7 +13,11 @@ class check{
}
};
int
main
(
int
,
char
**
){
int
main
(
int
argc
,
char
**
argv
){
if
(
argc
==
1
||
std
::
string
(
argv
[
1
])
!=
"-t"
){
std
::
cerr
<<
"error: invalid argument
\n
"
;
exit
(
-
1
);
}
printf
(
"Hello, from stl_debug!
\n
"
);
std
::
vector
<
Human
*>
vec
;
Human
human
(
25
,
"John Doe"
);
...
...
@@ -21,9 +27,17 @@ int main(int, char**){
for
(
const
auto
&
h
:
vec
)
{
std
::
cout
<<
h
->
print
();
}
// auto student1 = new Student(); //TODO: Error 1 : why?
auto
student1
=
static_cast
<
Student
*>
(
vec
.
back
());
// check check1 = check(student);
// check check1 = check(student);
//TODO: Error 2 : why?
check
check1
=
check
(
student1
);
LOG
(
DEBUG
)
<<
student1
->
print
();
LOG
(
WARNING
)
<<
human
.
print
();
// LOG(DEBUG) << student1->print();
// LOG(WARNING) << human.print();
// std::list<int> list;
// list.push_back(1);
// for(auto i: list){
// list.remove(i);
// }
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment