Comments (5)
Does the whole test-suite still run?
Not all, the demo.cpp and example.cpp still run, but basic.cpp has a build error : C2679: binary '<<': no operator found which takes a right-hand operand of type 'const user_defined_container<int,3>'
, the error place:
//basic.cpp
SECTION("containers") {
user_defined_container<int, 3> xs{{1, 2, 3}};
CHECK(pretty_print(xs) == "{1, 2, 3}"); // error C2679
}
Don't support user defined container, only STL container. if want to print user defined container, must overload operator <<, like this:
template <typename T, std::size_t N>
struct user_defined_container {
T data[N];
const T* begin() const { return data; }
const T* end() const { return data + N; }
const T* cbegin() const { return data+N-1; }
const T* cend() const { return data-1; }
std::size_t size() const { return N; }
friend std::ostream & operator<<( std::ostream & os, const user_defined_container & value)
{
for(auto i = value.begin(); i != value.end(); ++i)
{
os << *i;
}
return os;
}
};
It is appropriate for my project, So, I have no further changes.
from dbg-macro.
I'm sorry, but VS2015 is probably not supported. Newer versions should be, though.
dbg-macro/.github/workflows/ci.yml
Lines 11 to 27 in 4db6180
from dbg-macro.
I'm sorry, but VS2015 is probably not supported. Newer versions should be, though.
dbg-macro/.github/workflows/ci.yml
Lines 11 to 27 in 4db6180
Thanks for replay. I made some changes and dbg-macro is now available for use in my project. The changes are as follows
/*
template <typename T>
using detect_begin_t = decltype(detail::begin(std::declval<T>()));
template <typename T>
using detect_end_t = decltype(detail::end(std::declval<T>()));
template <typename T>
using detect_size_t = decltype(detail::size(std::declval<T>()));
template <typename T>
struct is_container {
static constexpr bool value =
is_detected<detect_begin_t, T>::value &&
is_detected<detect_end_t, T>::value &&
is_detected<detect_size_t, T>::value &&
!std::is_same<std::string,
typename std::remove_cv<
typename std::remove_reference<T>::type>::type>::value;
};
*/
template<typename T, typename _ = void>
struct is_container : std::false_type {};
template<typename... Ts>
struct is_container_helper {};
template<typename T>
struct is_container<
T,
typename std::conditional<
false,
is_container_helper<
typename std::decay<T>::type::value_type,
typename std::decay<T>::type::size_type,
typename std::decay<T>::type::allocator_type,
typename std::decay<T>::type::iterator,
typename std::decay<T>::type::const_iterator,
decltype(std::declval<T>().size()),
decltype(std::declval<T>().begin()),
decltype(std::declval<T>().end()),
decltype(std::declval<T>().cbegin()),
decltype(std::declval<T>().cend())
>,
void
>::type
> : public std::true_type {};
template <typename T>
struct is_container<const std::valarray<T> &> : public std::true_type { };
template <typename T, std::size_t N>
struct is_container<const std::array<T, N> &> : public std::true_type { };
I did some tests in VS2015 and VS2019 and it worked fine.
There may be some limitations, but I hope that someone with this problem can be helped.
from dbg-macro.
Nice.
There may be some limitations, but I hope that someone with this problem can be helped.
Does the whole test-suite still run?
from dbg-macro.
I see - thank you for clarifying. In this case, I think we can close this and people running into the same error on old MSVC versions will hopefully find your solution.
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
- debug print on some condition HOT 3
- use in Qt HOT 1
- Add output level HOT 2
- `Type does not support the << ostream operator` on custom type HOT 10
- 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.