diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-06-25 22:59:01 +0000 |
---|---|---|
committer | <> | 2013-09-27 11:49:28 +0000 |
commit | 8c4528713d907ee2cfd3bfcbbad272c749867f84 (patch) | |
tree | c09e2ce80f47b90c85cc720f5139089ad9c8cfff /libs/local_function/test/macro_commas_seq.cpp | |
download | boost-tarball-baserock/morph.tar.gz |
Imported from /home/lorry/working-area/delta_boost-tarball/boost_1_54_0.tar.bz2.boost_1_54_0baserock/morph
Diffstat (limited to 'libs/local_function/test/macro_commas_seq.cpp')
-rw-r--r-- | libs/local_function/test/macro_commas_seq.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libs/local_function/test/macro_commas_seq.cpp b/libs/local_function/test/macro_commas_seq.cpp new file mode 100644 index 000000000..f2e0f49af --- /dev/null +++ b/libs/local_function/test/macro_commas_seq.cpp @@ -0,0 +1,44 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/local_function + +#include <boost/local_function.hpp> +#include <boost/utility/identity_type.hpp> +#include <boost/typeof/std/string.hpp> // Type-of registrations +#include <boost/typeof/std/map.hpp> // needed for `NAME` macro. +#include <boost/config.hpp> +#include <map> +#include <string> + +std::string cat(const std::string& x, const std::string& y) { return x + y; } + +template<typename V, typename K> +struct key_sizeof { + static int const value; +}; + +template<typename V, typename K> +int const key_sizeof<V, K>::value = sizeof(K); + +typedef int sign_t; + +int main(void) { + void BOOST_LOCAL_FUNCTION( + (BOOST_IDENTITY_TYPE((const std::map<std::string, size_t>&)) m) + (BOOST_IDENTITY_TYPE((::sign_t)) sign) + (const size_t& factor) + (default (key_sizeof<std::string, size_t>::value)) + (const std::string& separator)(default cat(":", " ")) + ) { + // Do something... + } BOOST_LOCAL_FUNCTION_NAME(f) + + std::map<std::string, size_t> m; + ::sign_t sign = -1; + f(m, sign); + return 0; +} + |