1 /*
2 Copyright 2019 Glen Joseph Fernandes
3 (glenjofe@gmail.com)
4
5 Distributed under the Boost Software License, Version 1.0.
6 (http://www.boost.org/LICENSE_1_0.txt)
7 */
8 #include <boost/config.hpp>
9 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
10 !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
11 #include <boost/functional/value_factory.hpp>
12 #include <boost/core/lightweight_test.hpp>
13
14 class sum {
15 public:
sum(int a=0,int b=0,int c=0,int d=0,int e=0,int f=0,int g=0,int h=0,int i=0,int j=0,int k=0,int l=0)16 explicit sum(int a = 0, int b = 0, int c = 0, int d = 0,
17 int e = 0, int f = 0, int g = 0, int h = 0,
18 int i = 0, int j = 0, int k = 0, int l = 0)
19 : value_(a + b + c + d + e + f + g + h + i + j + k + l) { }
20
get() const21 int get() const {
22 return value_;
23 }
24
25 private:
26 int value_;
27 };
28
main()29 int main()
30 {
31 sum s(boost::value_factory<sum>()(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
32 BOOST_TEST(s.get() == 78);
33 return boost::report_errors();
34 }
35 #else
main()36 int main()
37 {
38 return 0;
39 }
40 #endif
41