From 6508587c025eb9cd133abe73759e12a2049bdfe1 Mon Sep 17 00:00:00 2001 From: Philip Pronin <philipp@fb.com> Date: Sun, 12 Jan 2014 14:37:26 -0800 Subject: [PATCH] add FB_SINGLE_ARG macro Test Plan: eyeballed it @override-unit-failures Reviewed By: soren@fb.com FB internal diff: D1125180 --- folly/Preprocessor.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/folly/Preprocessor.h b/folly/Preprocessor.h index 20fafabf..86b6a35f 100644 --- a/folly/Preprocessor.h +++ b/folly/Preprocessor.h @@ -1,5 +1,5 @@ /* - * Copyright 2013 Facebook, Inc. + * Copyright 2014 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,17 @@ // Support macro for the above #define FB_ARG_2_OR_1_IMPL(a, b, ...) b +/** + * Helper macro that provides a way to pass argument with commas in it to + * some other macro whose syntax doesn't allow using extra parentheses. + * Example: + * + * #define MACRO(type, name) type name + * MACRO(FB_SINGLE_ARG(std::pair<size_t, size_t>), x); + * + */ +#define FB_SINGLE_ARG(...) __VA_ARGS__ + /** * FB_ANONYMOUS_VARIABLE(str) introduces an identifier starting with * str and ending with a number that varies with the line. @@ -66,5 +77,4 @@ */ #define FB_STRINGIZE(name) #name - #endif // FOLLY_PREPROCESSOR_ -- 2.34.1