1//
2// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
3// Copyright (c) 2021-2023 Alexander Grund
4//
5// Distributed under the Boost Software License, Version 1.0.
6// https://www.boost.org/LICENSE_1_0.txt
7
8#ifndef BOOST_SRC_LOCALE_MO_LAMBDA_HPP_INCLUDED
9#define BOOST_SRC_LOCALE_MO_LAMBDA_HPP_INCLUDED
10
11#include <boost/locale/config.hpp>
12#include <memory>
13
14namespace boost { namespace locale { namespace gnu_gettext { namespace lambda {
15
16 struct BOOST_SYMBOL_VISIBLE expr {
17 using value_type = long long;
18 virtual value_type operator()(value_type n) const = 0;
19 virtual ~expr() = default;
20 };
21 using expr_ptr = std::unique_ptr<expr>;
22
23 class plural_expr {
24 expr_ptr p_;
25
26 public:
27 plural_expr() = default;
28 explicit plural_expr(expr_ptr p) : p_(std::move(p)) {}
29 expr::value_type operator()(expr::value_type n) const { return (*p_)(n); }
30 explicit operator bool() const { return static_cast<bool>(p_); }
31 };
32
33 BOOST_LOCALE_DECL plural_expr compile(const char* c_expression);
34
35}}}} // namespace boost::locale::gnu_gettext::lambda
36
37#endif
38

source code of boost/libs/locale/src/boost/locale/shared/mo_lambda.hpp