Utils.h (10428:0caf62b57dfd) Utils.h (10490:8647eb4489b8)
1/*
2 * Copyright (c) 2012-2014, TU Delft
3 * Copyright (c) 2012-2014, TU Eindhoven
4 * Copyright (c) 2012-2014, TU Kaiserslautern
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are

--- 40 unchanged lines hidden (view full) ---

49T fromString(const std::string& s,
50 std::ios_base& (*f)(std::ios_base &) = std::dec)
51throw(std::runtime_error)
52{
53 std::istringstream is(s);
54 T t;
55
56 if (!(is >> f >> t)) {
1/*
2 * Copyright (c) 2012-2014, TU Delft
3 * Copyright (c) 2012-2014, TU Eindhoven
4 * Copyright (c) 2012-2014, TU Kaiserslautern
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are

--- 40 unchanged lines hidden (view full) ---

49T fromString(const std::string& s,
50 std::ios_base& (*f)(std::ios_base &) = std::dec)
51throw(std::runtime_error)
52{
53 std::istringstream is(s);
54 T t;
55
56 if (!(is >> f >> t)) {
57 throw std::runtime_error("Cannot convert '" + s + "' to " +
58 typeid(t).name() + " using fromString");
57 throw std::runtime_error("fromString cannot convert " + s);
59 }
60
61 return t;
62}
63
64#endif /* UTILS_H */
58 }
59
60 return t;
61}
62
63#endif /* UTILS_H */