summaryrefslogtreecommitdiffstats
path: root/ue4/mycpu/cmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'ue4/mycpu/cmem.h')
-rw-r--r--ue4/mycpu/cmem.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/ue4/mycpu/cmem.h b/ue4/mycpu/cmem.h
index 6b23111..c6b8735 100644
--- a/ue4/mycpu/cmem.h
+++ b/ue4/mycpu/cmem.h
@@ -13,6 +13,7 @@
13#include <sstream> 13#include <sstream>
14#include <stdexcept> 14#include <stdexcept>
15#include <boost/lexical_cast.hpp> 15#include <boost/lexical_cast.hpp>
16#include <boost/algorithm/string.hpp>
16#ifdef DEBUG 17#ifdef DEBUG
17# include <iostream> 18# include <iostream>
18# include <iomanip> 19# include <iomanip>
@@ -23,7 +24,7 @@
23 * 24 *
24 * Extends std::vector template for use as memory for CCPU. 25 * Extends std::vector template for use as memory for CCPU.
25 */ 26 */
26template <class T> 27template<class T=CDat<int>, int width=0>
27class CMem 28class CMem
28 : public std::vector<T> 29 : public std::vector<T>
29{ 30{
@@ -55,7 +56,8 @@ class CMem
55 { 56 {
56 ++i; 57 ++i;
57 std::getline(in, line); 58 std::getline(in, line);
58 59 boost::algorithm::trim(line);
60
59 /* skip last line if it's empty */ 61 /* skip last line if it's empty */
60 if (line.empty() && in.eof()) 62 if (line.empty() && in.eof())
61 break; 63 break;
@@ -63,8 +65,9 @@ class CMem
63 T value; 65 T value;
64 try 66 try
65 { 67 {
66 if (!line.empty()) 68 if (!line.empty())
67 value = boost::lexical_cast<T>(line); 69 {
70 value = boost::lexical_cast<T>(line);
68 } 71 }
69 catch(boost::bad_lexical_cast& ex) 72 catch(boost::bad_lexical_cast& ex)
70 { 73 {