codac 1.5.6
Loading...
Searching...
No Matches
codac2_FunctionArgsList.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <vector>
13#include "codac2_VarBase.h"
14
15namespace codac2
16{
17 class FunctionArgsList : public std::vector<std::shared_ptr<VarBase>>
18 {
19 public:
20
21 FunctionArgsList()
22 { }
23
24 FunctionArgsList(const FunctionArgsList& args)
25 : std::vector<std::shared_ptr<VarBase>>(args.size())
26 {
27 size_t i = 0;
28 for(const auto& arg : args)
29 (*this)[i++] = arg->arg_copy();
30 }
31
32 FunctionArgsList(const std::vector<std::reference_wrapper<VarBase>>& args)
33 {
34 for(const auto& arg : args)
35 push_back(arg.get().arg_copy());
36 }
37
38 FunctionArgsList(std::initializer_list<std::reference_wrapper<VarBase>> args)
39 {
40 for(const auto& arg : args)
41 push_back(arg.get().arg_copy());
42 }
43
44 Index total_size() const
45 {
46 Index n = 0;
47 for(const auto& ai : *this)
48 n += ai->size();
49 return n;
50 }
51 };
52}