Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
basic_trie
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bartosz Ziemba
basic_trie
Commits
d984969f
Commit
d984969f
authored
3 years ago
by
Bartosz Ziemba
Browse files
Options
Downloads
Patches
Plain Diff
msvc compability
parent
97576ba6
Branches
master
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
.gitignore
+3
-1
3 additions, 1 deletion
.gitignore
CMakeLists.txt
+2
-1
2 additions, 1 deletion
CMakeLists.txt
CMakeSettings.json
+27
-0
27 additions, 0 deletions
CMakeSettings.json
main.cpp
+2
-6
2 additions, 6 deletions
main.cpp
main.h
+1
-6
1 addition, 6 deletions
main.h
trie/trie.h
+2
-2
2 additions, 2 deletions
trie/trie.h
with
37 additions
and
16 deletions
.gitignore
+
3
−
1
View file @
d984969f
.vscode/
build/
odm.txt
\ No newline at end of file
odm.txt
out/
.vs/
\ No newline at end of file
This diff is collapsed.
Click to expand it.
CMakeLists.txt
+
2
−
1
View file @
d984969f
cmake_minimum_required
(
VERSION 3.0.0
)
project
(
spellcheck VERSION 0.1.0
)
set
(
CXX_STANDARD 17
)
include
(
CTest
)
enable_testing
()
...
...
@@ -8,7 +9,7 @@ if(NOT CMAKE_BUILD_TYPE)
set
(
CMAKE_BUILD_TYPE Release
)
endif
()
set
(
CMAKE_CXX_FLAGS
"-Wall
-Wextra
"
)
set
(
CMAKE_CXX_FLAGS
"-Wall "
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"-g"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"-O3"
)
...
...
This diff is collapsed.
Click to expand it.
CMakeSettings.json
0 → 100644
+
27
−
0
View file @
d984969f
{
"configurations"
:
[
{
"name"
:
"x64-Debug"
,
"generator"
:
"Ninja"
,
"configurationType"
:
"Debug"
,
"inheritEnvironments"
:
[
"msvc_x64_x64"
],
"buildRoot"
:
"${projectDir}
\\
out
\\
build
\\
${name}"
,
"installRoot"
:
"${projectDir}
\\
out
\\
install
\\
${name}"
,
"cmakeCommandArgs"
:
""
,
"buildCommandArgs"
:
""
,
"ctestCommandArgs"
:
""
},
{
"name"
:
"x64-Release"
,
"generator"
:
"Ninja"
,
"configurationType"
:
"Release"
,
"buildRoot"
:
"${projectDir}
\\
out
\\
build
\\
${name}"
,
"installRoot"
:
"${projectDir}
\\
out
\\
install
\\
${name}"
,
"cmakeCommandArgs"
:
""
,
"buildCommandArgs"
:
""
,
"ctestCommandArgs"
:
""
,
"inheritEnvironments"
:
[
"msvc_x64_x64"
],
"variables"
:
[]
}
]
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
main.cpp
+
2
−
6
View file @
d984969f
...
...
@@ -19,12 +19,8 @@ int main(int argc, char** argv)
size_t
wrong_words_count
;
size_t
words_count
;
driver
.
spellcheck_file
(
argv
[
2
],
words_count
,
wrong_words_count
);
print
(
"Number of words: "
);
print
(
words_count
);
print_line
();
print
(
"Number of incorrect words: "
);
print
(
wrong_words_count
);
print_line
();
std
::
cout
<<
"Number of words: "
<<
words_count
<<
std
::
endl
;
std
::
cout
<<
"Number of incorrect words: "
<<
wrong_words_count
<<
std
::
endl
;
}
...
...
This diff is collapsed.
Click to expand it.
main.h
+
1
−
6
View file @
d984969f
...
...
@@ -6,11 +6,6 @@
#include
<locale>
#include
<vector>
void
print
(
auto
arg
)
{
std
::
cout
<<
arg
;
}
void
print_line
(
std
::
string
line
=
""
)
{
std
::
cout
<<
line
<<
"
\n
"
;
...
...
@@ -89,7 +84,7 @@ public:
std
::
u16string
u16wd
;
while
(
true
)
{
print
(
"Input word: "
)
;
std
::
cout
<<
"Input word: "
;
std
::
cin
>>
wd
;
u16wd
=
utf16conv
.
from_bytes
(
wd
);
if
(
trie
.
search
(
u16wd
))
...
...
This diff is collapsed.
Click to expand it.
trie/trie.h
+
2
−
2
View file @
d984969f
...
...
@@ -106,7 +106,7 @@ public:
{
TrieNode
*
current
=
&
root
;
for
(
uint
i
=
0
;
i
<
key
.
length
();
i
++
)
for
(
u
nsigned
int
i
=
0
;
i
<
key
.
length
();
i
++
)
{
current
=
&
current
->
get_child
(
key
[
i
]);
}
...
...
@@ -117,7 +117,7 @@ public:
bool
search
(
std
::
u16string
key
)
{
TrieNode
*
current
=
&
root
;
for
(
uint
i
=
0
;
i
<
key
.
length
();
i
++
)
for
(
u
nsigned
int
i
=
0
;
i
<
key
.
length
();
i
++
)
{
//std::cout << "next index is " << index << "\n";
if
(
!
current
->
has_child
(
key
[
i
]))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment