forked from HowardHinnant/date
Fix dangling reference bug in parse
This commit is contained in:
@@ -8,7 +8,7 @@ https://github.com/HowardHinnant/date/commit/19c83e47ed411a45e0b5a45d772c47c6ee2
|
|||||||
|
|
||||||
Without this update your tz lib will download a new copy of the database everytime you start your program.
|
Without this update your tz lib will download a new copy of the database everytime you start your program.
|
||||||
<hr/>
|
<hr/>
|
||||||
_**[Try it out on wandbox!](http://melpon.org/wandbox/permlink/lb6FHxHyQ1V9eCLm)**_
|
_**[Try it out on wandbox!](http://melpon.org/wandbox/permlink/FyeHIhAg2dniVu0W)**_
|
||||||
|
|
||||||
This is actually several separate C++11/C++14 libraries:
|
This is actually several separate C++11/C++14 libraries:
|
||||||
|
|
||||||
|
24
date.h
24
date.h
@@ -4365,16 +4365,16 @@ parse(std::basic_istream<CharT, Traits>& is,
|
|||||||
template <class Duration, class CharT, class Traits = std::char_traits<CharT>>
|
template <class Duration, class CharT, class Traits = std::char_traits<CharT>>
|
||||||
struct parse_local_manip
|
struct parse_local_manip
|
||||||
{
|
{
|
||||||
const std::basic_string<CharT, Traits>& format_;
|
const std::basic_string<CharT, Traits> format_;
|
||||||
local_time<Duration>& tp_;
|
local_time<Duration>& tp_;
|
||||||
std::basic_string<CharT, Traits>* abbrev_;
|
std::basic_string<CharT, Traits>* abbrev_;
|
||||||
std::chrono::minutes* offset_;
|
std::chrono::minutes* offset_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
parse_local_manip(const std::basic_string<CharT, Traits>& format,
|
parse_local_manip(std::basic_string<CharT, Traits> format,
|
||||||
local_time<Duration>& tp, std::basic_string<CharT, Traits>* abbrev = nullptr,
|
local_time<Duration>& tp, std::basic_string<CharT, Traits>* abbrev = nullptr,
|
||||||
std::chrono::minutes* offset = nullptr)
|
std::chrono::minutes* offset = nullptr)
|
||||||
: format_(format)
|
: format_(std::move(format))
|
||||||
, tp_(tp)
|
, tp_(tp)
|
||||||
, abbrev_(abbrev)
|
, abbrev_(abbrev)
|
||||||
, offset_(offset)
|
, offset_(offset)
|
||||||
@@ -4394,16 +4394,16 @@ operator>>(std::basic_istream<CharT, Traits>& is,
|
|||||||
template <class Duration, class CharT, class Traits = std::char_traits<CharT>>
|
template <class Duration, class CharT, class Traits = std::char_traits<CharT>>
|
||||||
struct parse_sys_manip
|
struct parse_sys_manip
|
||||||
{
|
{
|
||||||
const std::basic_string<CharT, Traits>& format_;
|
const std::basic_string<CharT, Traits> format_;
|
||||||
sys_time<Duration>& tp_;
|
sys_time<Duration>& tp_;
|
||||||
std::basic_string<CharT, Traits>* abbrev_;
|
std::basic_string<CharT, Traits>* abbrev_;
|
||||||
std::chrono::minutes* offset_;
|
std::chrono::minutes* offset_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
parse_sys_manip(const std::basic_string<CharT, Traits>& format,
|
parse_sys_manip(std::basic_string<CharT, Traits> format,
|
||||||
sys_time<Duration>& tp, std::basic_string<CharT, Traits>* abbrev = nullptr,
|
sys_time<Duration>& tp, std::basic_string<CharT, Traits>* abbrev = nullptr,
|
||||||
std::chrono::minutes* offset = nullptr)
|
std::chrono::minutes* offset = nullptr)
|
||||||
: format_(format)
|
: format_(std::move(format))
|
||||||
, tp_(tp)
|
, tp_(tp)
|
||||||
, abbrev_(abbrev)
|
, abbrev_(abbrev)
|
||||||
, offset_(offset)
|
, offset_(offset)
|
||||||
|
Reference in New Issue
Block a user