templates help

D

Devender Rao

I am having code from a library as shown below. I am not able to understand the purpose of "class ErrorAccessingPrivilegedAttribute;". Not sure how it works.


#define FAPI_ATTR_GET(ID, PTARGET, VAL) \
(fapiFailIfPrivileged<fapi::ID##_Privileged>(), \
fapiCheckIdType<fapi::ID##_Type>(ID, VAL), \
ID##_GETMACRO(ID, PTARGET, VAL))

template<typename T> inline void fapiCheckIdType(AttributeId, T &) {}

class ErrorAccessingPrivilegedAttribute;
template<const bool PRIVILEGED> void fapiFailIfPrivileged()
{
ErrorAccessingPrivilegedAttribute();
}
template <> inline void fapiFailIfPrivileged<false>() {}

Thank you in advance for any help.
 
V

Victor Bazarov

I am having code from a library as shown below. I am not able to
understand the purpose of "class ErrorAccessingPrivilegedAttribute;".
Not sure how it works.

It's a forward declaration. It lets the compiler know that the name is
that of a class.
#define FAPI_ATTR_GET(ID, PTARGET, VAL) \
(fapiFailIfPrivileged<fapi::ID##_Privileged>(), \
fapiCheckIdType<fapi::ID##_Type>(ID, VAL), \
ID##_GETMACRO(ID, PTARGET, VAL))

template<typename T> inline void fapiCheckIdType(AttributeId, T &) {}

class ErrorAccessingPrivilegedAttribute;
template<const bool PRIVILEGED> void fapiFailIfPrivileged()
{
ErrorAccessingPrivilegedAttribute();
}
template <> inline void fapiFailIfPrivileged<false>() {}

Thank you in advance for any help.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top