Comments (2)
static_cast<std::ostringstream&>(std::ostringstream{} << x).str();
works well
from hana.
Here's what I think happens: std::ostringstream{} << x
returns a std::basic_ostream<char>
when it is used with a std::string
, because the operator<<
is defined as:
template<class _CharT, class _Traits, class _Allocator>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const basic_string<_CharT, _Traits, _Allocator>& __str);
Then, we try to .str()
that basic_ostream
, which results in the provided error. I had never thought about the fact that operator<<
would return a basic_ostream
; I find that badly designed and counterintuitive. Still, I'll fix the examples.
Thanks for reporting.
from hana.
Related Issues (20)
- BOOST_HANA_ADAPT_STRUCT default max members decreased, breaking backwards compatibility
- Hana runtime performance is 100 times less than native cpp? HOT 2
- hana::sort seems like it should work with hana::experimental::types but does't HOT 3
- Passing move-only arguments as 2nd(-and-following) argument(s) to hana::partial results in compile-time failure
- Integrate Boost.Describe into Boost.Hana?
- How to use hana containers as class data members? HOT 1
- Build Error C2039 with MSVC when using /std:c++latest (C++20) - std::is_literal_type removed HOT 1
- Doxygen issues HOT 1
- Get warnings with clang14 HOT 2
- Is there a replacement for fusion::nview HOT 6
- Circular dependency of boost/hana/concept/struct.hpp and boost/hana/accessors.hpp breaks tooling
- boost::hana::drop_front doesn't respect refness HOT 1
- 'apply': identifier not found inside a lambda function HOT 1
- Hana failed to build with error C2065, error C2977, error C2913... on MSVC HOT 2
- Is it possible to get back the C++ type from hana::type? HOT 1
- A proposal that works like BOOST_HANA_DEFINE/ADAPT_STRUCT and makes it 5x faster. HOT 2
- "Try it" link is broken. HOT 1
- some compile error when I use msvc2022 HOT 4
- Question: has clang __PRETTY_FUNCTION__ behavior changed in clang 16.0.0 ? HOT 1
- std::aligned_storage and std::aligned_union deprecated in C++23
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hana.