Remove uses of std::endl, which imply a flush

This commit is contained in:
Jason Turner
2014-11-13 10:13:51 -07:00
parent 8a30581eaf
commit 63a083b47b
15 changed files with 75 additions and 79 deletions

View File

@@ -207,7 +207,7 @@ namespace chaiscript
static void println(const std::string &s)
{
std::cout << s << std::endl;
std::cout << s << '\n';
}

View File

@@ -89,13 +89,13 @@ namespace chaiscript
if (t_conversions && t_conversions->convertable_type<Type>())
{
try {
// std::cout << "trying an up conversion " << typeid(Type).name() << std::endl;
// std::cout << "trying an up conversion " << typeid(Type).name() << '\n';
// We will not catch any bad_boxed_dynamic_cast that is thrown, let the user get it
// either way, we are not responsible if it doesn't work
return detail::Cast_Helper<Type>::cast(t_conversions->boxed_type_conversion<Type>(bv), t_conversions);
} catch (...) {
try {
// std::cout << "trying a down conversion " << typeid(Type).name() << std::endl;
// std::cout << "trying a down conversion " << typeid(Type).name() << '\n';
// try going the other way - down the inheritance graph
return detail::Cast_Helper<Type>::cast(t_conversions->boxed_type_down_conversion<Type>(bv), t_conversions);
} catch (const chaiscript::detail::exception::bad_any_cast &) {

View File

@@ -796,7 +796,7 @@ namespace chaiscript
/// Dump object info to stdout
void dump_object(const Boxed_Value &o) const
{
std::cout << (o.is_const()?"const ":"") << type_name(o) << std::endl;
std::cout << (o.is_const()?"const ":"") << type_name(o) << '\n';
}
/// Dump type info to stdout
@@ -830,7 +830,7 @@ namespace chaiscript
}
}
std::cout << ") " << std::endl;
std::cout << ") \n";
}
/// Returns true if a call can be made that consists of the first parameter
@@ -850,7 +850,7 @@ namespace chaiscript
/// Dump all system info to stdout
void dump_system() const
{
std::cout << "Registered Types: " << std::endl;
std::cout << "Registered Types: \n";
std::vector<std::pair<std::string, Type_Info> > types = get_types();
for (std::vector<std::pair<std::string, Type_Info> >::const_iterator itr = types.begin();
itr != types.end();
@@ -858,20 +858,20 @@ namespace chaiscript
{
std::cout << itr->first << ": ";
std::cout << itr->second.bare_name();
std::cout << std::endl;
std::cout << '\n';
}
std::cout << std::endl;
std::cout << '\n';
std::vector<std::pair<std::string, Proxy_Function > > funcs = get_functions();
std::cout << "Functions: " << std::endl;
std::cout << "Functions: \n";
for (std::vector<std::pair<std::string, Proxy_Function > >::const_iterator itr = funcs.begin();
itr != funcs.end();
++itr)
{
dump_function(*itr);
}
std::cout << std::endl;
std::cout << '\n';
}
/// return true if the Boxed_Value matches the registered type by name

View File

@@ -429,11 +429,7 @@ namespace chaiscript
static_assert(std::is_convertible<From, To>::value, "Types are not automatically convertible");
auto func = [](const Boxed_Value &t_bv) -> Boxed_Value {
// not even attempting to call boxed_cast so that we don't get caught in some call recursion
std::cout << " Type conversion to : " << typeid(To).name() << " from " << typeid(From).name() << std::endl;
auto &&from = detail::Cast_Helper<From>::cast(t_bv, nullptr);
std::cout << "Ptr" << static_cast<const void *>(from) << std::endl;
std::cout << "Ptr" << from << std::endl;
To to(from);
return chaiscript::Boxed_Value(to);
};