mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Add commit 43aab01 of BenHanson/lexertl14 from github
This commit is contained in:
committed by
Luis Ángel San Martín
parent
c4f792bd40
commit
d3de52ca82
25
YACReaderLibrary/lexertl/narrow.hpp
Normal file
25
YACReaderLibrary/lexertl/narrow.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
// narrow.hpp
|
||||
// Copyright (c) 2015-2018 Ben Hanson (http://www.benhanson.net/)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef LEXERTL_NARROW_HPP
|
||||
#define LEXERTL_NARROW_HPP
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace lexertl
|
||||
{
|
||||
template<typename char_type>
|
||||
void narrow(const char_type *str_, std::ostringstream &ss_)
|
||||
{
|
||||
while (*str_)
|
||||
{
|
||||
// Safe to simply cast to char.
|
||||
// when string only contains ASCII.
|
||||
ss_ << static_cast<char>(*str_++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user