# Interpreter can't print valarray value

**URL:** <https://root-forum.cern.ch/t/interpreter-cant-print-valarray-value/64357>\
**Category:** Cling\
**Created:** [October 24, 2025, 6:09pm UTC](https://root-forum.cern.ch/t/interpreter-cant-print-valarray-value/64357 "2025-10-24T18:09:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![petrillo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/a4c791/32.png) [@petrillo](https://root-forum.cern.ch/u/petrillo)\
**Post date:** [October 24, 2025, 6:09pm UTC](https://root-forum.cern.ch/t/interpreter-cant-print-valarray-value/64357/1 "2025-10-24T18:09:04Z")

</div>

The ROOT interpreter (6.36.04) seems to fail to print a `std::valarray` object.

```auto
root [0] std::valarray<float> v(10);
root [1] v
In module 'Cling_Runtime' imported from input_line_2:1:
/usr/share/root/cling/Interpreter/RuntimePrintValue.h:206:24: error: no member named 'begin' in 'std::valarray<float>'
      auto iter = obj->begin();
                  ~~~ ^
/usr/share/root/cling/Interpreter/RuntimePrintValue.h:246:39: note: in instantiation of function template specialization 'cling::collectionPrinterInternal::printValue_impl<std::valarray<float> >'
      requested here
    return collectionPrinterInternal::printValue_impl(obj);
                                      ^
note: in instantiation of function template specialization 'cling::printValue<std::valarray<float> >' requested here
/usr/share/root/cling/Interpreter/RuntimePrintValue.h:207:27: error: no member named 'end' in 'std::valarray<float>'
      auto iterEnd = obj->end();
                     ~~~ ^
(std::valarray<float> &) ERROR in cling's callPrintValue(): missing value string.

```

Considering that the previous line of `cling/Interpreter/RuntimePrintValue.h` has already verified that `std::begin(v)` and `std::end(v)` are available, that function may as well use them.

I can try to provide a patch if desired.

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [October 25, 2025, 12:04pm UTC](https://root-forum.cern.ch/t/interpreter-cant-print-valarray-value/64357/2 "2025-10-25T12:04:36Z")

</div>

> [@petrillo](#):
>
> I can try to provide a patch if desired.

Thanks, yes, feel free to submit a PR in GitHub, ideally adding also a Ctest in the corresponding test/ folder.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [November 8, 2025, 12:11pm UTC](https://root-forum.cern.ch/t/interpreter-cant-print-valarray-value/64357/3 "2025-11-08T12:11:42Z")

</div>

Closed on November 8, 2025, 12:11pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
