lexical-cast Questions

3

Solved

I'm writing unit tests and trying to have all my code covered. I have in my code something like this: template<typename ValueType> std::string ConvertToStringUsingBoost(ValueType const&...
Pianette asked 1/5, 2019 at 11:30

2

Solved

What's the purpose of boost::to_string (found in boost/exception/to_string.hpp) and how does it differ from boost::lexical_cast<std::string> and std::to_string?
Esmeraldaesmerelda asked 1/4, 2015 at 19:20

3

Solved

Here's a testcase: #include <istream> #include <boost/lexical_cast.hpp> namespace N { enum class alarm_code_t { BLAH }; } std::istream& operator>>(std::istream& is, ...
Febrifacient asked 15/8, 2016 at 14:55

2

Solved

I have this code which is based on several posts in SO: boost::uuids::uuid uuid = boost::uuids::random_generator()(); auto uuidString= boost::lexical_cast<std::string>(uuid); but when I am...
Microfilm asked 14/4, 2015 at 15:12

9

Solved

Windows XP SP3. Core 2 Duo 2.0 GHz. I'm finding the boost::lexical_cast performance to be extremely slow. Wanted to find out ways to speed up the code. Using /O2 optimizations on visual c++ 2008 an...
Listlessness asked 9/8, 2009 at 6:17

1

Solved

I have the following code: #include <iostream> #include <boost\lexical_cast.hpp> struct vec2_t { float x; float y; }; std::istream& operator>>(std::istream& istream, ...
Wildman asked 18/11, 2014 at 8:32

3

Solved

I've seen some answers to other boost::lexical_cast questions that assert the following is possible: bool b = boost::lexical_cast< bool >("true"); This doesn't work for me with g++ 4.4.3 b...
Troytroyer asked 15/12, 2010 at 16:13

1

Solved

I am trying to concatenate an integer to a known string, and I have found that there are several ways to do it, two of those being: int num=13; string str = "Text" + static_cast<ostringstream*&...
Smutty asked 22/7, 2013 at 15:3

1

Solved

I want to use my Test class with boost::lexical_cast. I have overloaded operator<< and operator>> but It gives me runtime error. Here is my code: #include <iostream> #include &lt...
Seneschal asked 30/4, 2012 at 11:24

1

Code snippet from lexical_cast: class lexical_castable { public: lexical_castable() {}; lexical_castable(const std::string s) : s_(s) {}; friend std::ostream operator<< (std::ostream&am...
Absolve asked 25/12, 2011 at 16:30

1

Solved

g++ doesn't like: vector<int> x; x += 1,2,3,4,5; vector<string> y(x.size()); transform(x.begin(), x.end(), y.begin(), lexical_cast<string>); The error message is: error: no m...
Strychnic asked 13/6, 2011 at 20:14

2

Solved

I have the following function that will convert a string into a numeric data type: template <typename T> bool ConvertString(const std::string& theString, T& theResult) { std::istrin...
Sagacity asked 6/10, 2009 at 22:10

3

Solved

Is it safe to ignore exception of boost::lexical_cast when converting int to std::string?
Liquid asked 29/4, 2010 at 9:16

2

Solved

I would like to write something like this, which cannot be compiled: std::vector<A> as; std::vector<B> bs( as.size() ); std::transform( as.beginn(), as.end(), bs.begin(), boost::lexica...
Reverberation asked 13/2, 2010 at 20:0
1

© 2022 - 2024 — McMap. All rights reserved.