# Fill Branch from Vector of Vectors

**URL:** <https://root-forum.cern.ch/t/fill-branch-from-vector-of-vectors/55906>\
**Category:** Newbie\
**Created:** [August 3, 2023, 1:17pm UTC](https://root-forum.cern.ch/t/fill-branch-from-vector-of-vectors/55906 "2023-08-03T13:17:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [August 7, 2023, 1:41pm UTC](https://root-forum.cern.ch/t/fill-branch-from-vector-of-vectors/55906/2 "2023-08-07T13:41:57Z")

</div>

Hi,

You would need to generate first the dictionary for the required class (std::vector\<std::vector\>).  
You can do this by using first ACLIC and then you can run your code.  
Here is the fixed macro:

```auto
#include <vector>
#include <TTree.h>

// line needed to generate the dictionary
#pragma link C++ class std::vector<std::vector<float>>+;

void test() {
auto myVector = new std::vector<std::vector<float>>;
auto myTree = new TTree("t","t");
myTree->Branch("myVector", "std::vector<std::vector<float>>", &myVector);
std::vector<float> test;
test.push_back(1.);
myVector->push_back(test);
myTree->Fill();
myVector->clear();

myTree->Print();

}

```

And you need first to run ACLIC:

```auto
root> .L test.C+
root> test() 

```

---

_[View the full topic](https://root-forum.cern.ch/t/fill-branch-from-vector-of-vectors/55906)._
