Comments (10)
Thank you for reporting this. Can you provide an example that I could reproduce (without dependencies on external libraries)?
from dbg-macro.
Strange, I cann't reproduce this in other project.
The thing that I don't understand is, std::cout << pos;
works fine, but dbg(pos);
not.
Here is the build error output.
[build] In file included from ../sight_external_widgets.cpp:8:
[build] In file included from ../dependencies/sight-util/sight_defines.h:11:
[build] ../dependencies/dbg-macro/dbg.h:443:3: error: static_assert failed due to requirement 'detail::has_ostream_operator<const ImVec2 &>::value' "Type does not support the << ostream operator"
[build] static_assert(detail::has_ostream_operator<const T&>::value,
[build] ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] ../dependencies/dbg-macro/dbg.h:452:3: note: in instantiation of function template specialization 'dbg::pretty_print<ImVec2>' requested here
[build] pretty_print(stream, value,
[build] ^
[build] ../dependencies/dbg-macro/dbg.h:773:38: note: in instantiation of function template specialization 'dbg::pretty_print<ImVec2>' requested here
[build] const bool print_expr_and_type = pretty_print(stream_value, ref);
[build] ^
[build] ../dependencies/dbg-macro/dbg.h:765:12: note: in instantiation of function template specialization 'dbg::DebugOutput::print_impl<ImVec2 &>' requested here
[build] return print_impl(exprs.begin(), types.begin(), std::forward<T>(values)...);
[build] ^
[build] ../sight_external_widgets.cpp:196:9: note: in instantiation of function template specialization 'dbg::DebugOutput::print<ImVec2 &>' requested here
[build] dbg(pos); // Type does not support the << ostream operator
[build] ^
[build] ../dependencies/dbg-macro/dbg.h:893:8: note: expanded from macro 'dbg'
[build] .print({DBG_MAP(DBG_STRINGIFY, __VA_ARGS__)}, \
[build] ^
[build] 1 error generated.
[build] ninja: build stopped: subcommand failed.
[build] Build finished with exit code 1
If you are still interested, you can check the code at https://github.com/Aincvy/sight.
from dbg-macro.
Could you try moving the ostream
operator definition into the global namespace?
from dbg-macro.
I have tried this: move it into a namespace, and the error reproduces.
Here is the code file
test-code.zip
.
from dbg-macro.
I am not sure, but I don't think this is good practice... shouldn't the ostream operator be defined in the global namespace?
from dbg-macro.
I don't know....
I did not find too may things about that.It seems not a well-known rule.
Would you fix it or not?
If not, could you please add something into readme file?
from dbg-macro.
see for example: https://stackoverflow.com/a/9230853/704831
If there is a clear guideline somewhere that it is OKAY to overload the operator within the user namespace, I'm inclined to fix this in dbg.h
. Any help is appreciated.
from dbg-macro.
I move the struct ImVec2
into the namespace sight
, then it compiles fine.
Looks like the operator overloading function isn't found.
A bug in the compiler perhaps.
Using decltype fails with an operator using non-ADL lookup
Namespaces and Operator Overloading in C++
from dbg-macro.
Ok, so you say this can be closed? Or has the bug not been fixed?
from dbg-macro.
I think we can do nothing about that, close it.
from dbg-macro.
Related Issues (20)
- Windows Supported? HOT 14
- Broken output of containers HOT 6
- How about output "{?}" string for unknown types instead of failing with static assert? HOT 2
- Allow specifying the output stream HOT 9
- Is support it for android ? HOT 2
- Is it possible to allow variadic template expansion? HOT 8
- VS2015:error C2912 HOT 5
- debug print on some condition HOT 3
- use in Qt HOT 1
- Add output level HOT 2
- multithread support HOT 1
- Support always on colors HOT 2
- Nested dbg(...) expansion as not expected HOT 2
- How to force print the full content, not the one with ellipsis HOT 3
- Support for container adapters HOT 1
- Fails with Eigen matrices HOT 7
- Suggest /usr/local/include instead of /usr/include HOT 3
- Report a compiling error with old GCC version (GCC 4.8.5) HOT 1
- Some enhancement proposals for CMake based usecases HOT 1
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 dbg-macro.