For cases when multiple badge holders need to call a function we can use folly::any_badge over each individual holder allowed. We allow subsets of badges to lift into supersets: folly::any_badge[ lifts into folly::any_badge[.]]
Synopsis
Declared in <folly/lang/Badge.h>
template<typename... Holders>
class any_badge;
Description
Example: class ProtectedClass: { public: static void func(folly::any_badge<FriendClass, OtherFriendClass>); };
void FriendClass::callProtectedFunc() { ProtectedClass::func(folly::badge<FriendClass>{}); // compiles } void OtherFriendClass::callProtectedFunc() { ProtectedClass::func(folly::badge<OtherFriendClass>{}); // compiles }
Member Functions
Name |
Description |
|
Constructors |
Created with MrDocs