我编写了一个operator<<处理的专门化boost::multi_array,并使用ConstMultiArrayConcept它以便它可以在外部数组和子数组上工作.我想知道,为什么这些multi_array概念有一个std::size_t NumDims模板参数,因为它可以简单地从中提取出来multi_array.NumDimsin 的唯一用途ConstMultiArrayConcept是作为递归深度arg idgen_helper,用于测试切片.
作为参考,这里是multi_array概念的标题:http:
//www.boost.org/doc/libs/1_51_0/boost/multi_array/concept_checks.hpp
这是我的超载 operator<<
template <typename CharT, typename Traits, typename MultiArrayT>
BOOST_CONCEPT_REQUIRES(
((boost::multi_array_concepts::ConstMultiArrayConcept<MultiArrayT, MultiArrayT::dimensionality>)),
(std::basic_ostream<CharT, Traits>&)) // return type
operator <<( std::basic_ostream<CharT, Traits>& os, MultiArrayT const& ary )
{
typename std::basic_ostream<CharT, Traits>::sentry opfx( os );
if ( opfx ) {
boost::multi_array_types::size_type const* sizes = ary.shape();
// using Mathematica array notation
os << "{";
for ( …Run Code Online (Sandbox Code Playgroud) 我正在调试一些模板代码,并且希望 lldb 向我显示框架变量的实际类型(c 类型),而不是极其复杂的 typedef。实际类型类似于“int”或“unsigned char”,但它只向我显示 typedef,就好像它不知道特定的模板实例一样。
例如:
template <typename T>
struct helper
{
using type = long;
};
int main(int argc, const char * argv[]) {
using var_t = typename helper<short>::type;
var_t foo = 1;
}
Run Code Online (Sandbox Code Playgroud)
在“var_t foo = 1”上设置的断点处停止显示
foo = (var_t)0
Run Code Online (Sandbox Code Playgroud)
我真的需要看到类似的东西
foo = (long)0
Run Code Online (Sandbox Code Playgroud)
有什么方法可以做到这一点,或者找出解析的类型是什么?
我正在使用 XCode 7.3 和 lldb-350.0.21.3