This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TDA4VM:错误:类"c7x::Element_count_of<const float16>"没有成员"值"

Guru**** 2540720 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1240801/tda4vm-error-class-c7x-element_count_of-const-float16-has-no-member-value

器件型号:TDA4VM

您好!

我创建了一个帮助模板来打印向量的内容:

template<typename T>
static inline void PrintVector(std::string name, T& vec)
{
    std::cout << "****************************" << std::endl;
    std::cout << name << ": { ";
    int count = c7x::element_count_of<T>::value;
    for (int i = 0; i < count; i++)
    {
        std::cout << vec.s[i];
        if (i < (count -1)) // Don't print comma for last element
        {
            std::cout << ", ";
        }
    }
    std::cout << " }" << std::endl;
}

它工作正常、直到我使用恒定向量。 似乎它们未在 c7x_scalable.h 中实例化。 这是可以在 API 中修复的问题吗?

谢谢。

弗雷德

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您通知我们此问题并提供一个简短的测试案例。  我可以重现相同的行为。  我提交了条目 EXT_EP-11205 来对此进行调查。  我们欢迎您通过这个链接来了解这一点。

    请考虑以下解决方法...

    #include <type_traits>
    
    template<typename T>
    static inline void PrintVector(std::string name, T& vec)
    {
        using NCT = std::remove_const_t<T>;
        std::cout << "****************************" << std::endl;
        std::cout << name << ": { ";
        int count = c7x::element_count_of<NCT>::value;
        for (int i = 0; i < count; i++)
        {
            std::cout << vec.s[i];
            if (i < (count -1)) // Don't print comma for last element
            {
                std::cout << ", ";
            }
        }
        std::cout << " }" << std::endl;
    }

    注意新类型 NCT 。  建议 t 不使用 常量 PMBus 限定符。  移除_const_t 来自 UCD 器件的标准头文件、

    谢谢。此致、

    -乔治

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    谢谢、George