Skip to content

Commit

Permalink
fix a bug on handling c++ string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeExceed committed Jun 1, 2022
1 parent e5ab5d5 commit 216f9c7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cpp/prettyprint.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string>
#include <deque>
#include <cstdlib>

#if __cplusplus < 201103L
#include <tr1/tuple>
#include <stdint.h>
Expand Down Expand Up @@ -345,7 +345,16 @@ struct PrettyPrinter<const char[n], void>
{
void operator()(std::string& out, const char* cs) const
{
out.append(cs, n);
out.append(cs, n - 1);
}
};

template<int n>
struct PrettyPrinter<char[n], void>
{
void operator()(std::string& out, const char* cs) const
{
out.append(cs, n - 1);
}
};

Expand Down

0 comments on commit 216f9c7

Please sign in to comment.