Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Changes
Page history
Update cpp
authored
Mar 19, 2024
by
umaumax
Show whitespace changes
Inline
Side-by-side
cpp.md
View page @
332b4c6e
...
...
@@ -1911,7 +1911,7 @@ bool IsFileExist(const std::string &filename) {
#include
<iterator>
#include
<vector>
std
::
vector
<
uint8_t
>
LoadFileGood
(
std
::
string
&
filepath
)
{
std
::
vector
<
uint8_t
>
LoadFileGood
(
const
std
::
string
&
filepath
)
{
std
::
ifstream
file
(
filepath
,
std
::
ios
::
binary
);
if
(
file
.
fail
())
{
return
std
::
vector
<
uint8_t
>
();
...
...
@@ -1930,14 +1930,14 @@ std::vector<uint8_t> LoadFileGood(std::string& filepath) {
return
vec
;
}
std
::
vector
<
uint8_t
>
LoadFileGood_istreambuf_iterator
(
std
::
string
&
filepath
)
{
std
::
vector
<
uint8_t
>
LoadFileGood_istreambuf_iterator
(
const
std
::
string
&
filepath
)
{
std
::
ifstream
is
(
filepath
,
std
::
ios
::
in
|
std
::
ios
::
binary
);
std
::
istreambuf_iterator
<
char
>
start
(
is
),
end
;
std
::
vector
<
uint8_t
>
content
(
start
,
end
);
return
content
;
}
std
::
vector
<
uint8_t
>
LoadFileBad_istream_iterator
(
std
::
string
&
filepath
)
{
std
::
vector
<
uint8_t
>
LoadFileBad_istream_iterator
(
const
std
::
string
&
filepath
)
{
std
::
ifstream
is
(
filepath
,
std
::
ios
::
in
|
std
::
ios
::
binary
);
std
::
istream_iterator
<
char
>
start
(
is
),
end
;
std
::
vector
<
uint8_t
>
content
(
start
,
end
);
...
...
...
...