MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / set_vector

Function set_vector

src/value.cpp:97–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97static void set_vector(std::shared_ptr<value_base_impl>& x,
98 const std::vector<value>& v,
99 bool array_on_empty = true)
100{
101 if(v.empty())
102 {
103 if(array_on_empty)
104 x = std::make_shared<array_value_holder>();
105 else
106 x = std::make_shared<object_value_holder>();
107 return;
108 }
109 if(v.front().get_key().empty())
110 {
111 x = std::make_shared<array_value_holder>(v);
112 }
113 else
114 {
115 std::map<std::string, std::size_t> lookup;
116 std::size_t i = 0;
117 for(auto&& e : v)
118 {
119 lookup[e.get_key()] = i;
120 i++;
121 }
122 x = std::make_shared<object_value_holder>(v, lookup);
123 }
124}
125
126value::value(const std::initializer_list<value>& i) : x(nullptr)
127{

Callers 1

valueMethod · 0.85

Calls 2

frontMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected