0
点赞
收藏
分享

微信扫一扫

SpringBoot整合SpringSecurit(二)通过token进行访问

诗远 2024-06-09 阅读 5

#include <iostream>


template<typename Tag, typename Tag::type M>
struct Rob {
    friend typename Tag::type get(Tag){
        return M;
    }
};

// use
struct A {
    A(int a):a(a){}
private:
    int a;
};

// tag used to access A::a
struct A_f{
    typedef int A::*type;
    friend type get(A_f);
};

template struct Rob<A_f, &A::a>;

int main(){
    A a(42);
    std::cout << "proof:" << a.*get(A_f()) << std::endl;
}

举报

相关推荐

0 条评论