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: error: class "c7x::element_count_of<const float16>" has no member "value"

Part Number: TDA4VM

Hi,

I created a template helper to print the contents of a vector:

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;
}

It works fine until I use a const vector. Seems that those aren't instantiated in c7x_scalable.h. Is this something that could be fixed in the API?

Thanks,

Fred

  • Thank you for notifying us of this problem, and supplying a concise test case.  I can reproduce the same behavior.  I filed the entry EXT_EP-11205 to have this investigated.  You are welcome to follow it with that link.

    Please consider the following workaround ...

    #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;
    }

    Note the new type NCT.  It is T without the const qualifier, if present.  remove_const_t comes from the standard header file <type_traits>.

    Thanks and regards,

    -George

  • Thanks, George