[meta.define.static]

# 21 Metaprogramming library [[meta]](./#meta)

## 21.4 Reflection [[meta.reflection]](meta.reflection#meta.define.static)

### 21.4.3 Promoting to static storage strings [meta.define.static]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/meta.tex#L3367)

The functions in this subclause promote compile-time storage into static storage[.](#1.sentence-1)

[ð](#lib:define_static_string)

`template<ranges::[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") R>
  consteval const ranges::range_value_t<R>* define_static_string(R&& r);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/meta.tex#L3377)

*Effects*: Equivalent to:return extract<const ranges::range_value_t<R>*>(meta::reflect_constant_string(r));

[ð](#lib:define_static_array)

`template<ranges::[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") R>
  consteval span<const ranges::range_value_t<R>> define_static_array(R&& r);
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/meta.tex#L3392)

*Effects*: Equivalent to:using T = ranges::range_value_t<R>;
meta::info array = meta::reflect_constant_array(r);if (is_array_type(type_of(array))) {return span<const T>(extract<const T*>(array), extent(type_of(array)));} else {return span<const T>();}

[ð](#lib:define_static_object)

`template<class T>
  consteval const remove_cvref_t<T>* define_static_object(T&& t);
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/meta.tex#L3413)

*Effects*: Equivalent to:using U = remove_cvref_t<T>;if constexpr (is_class_type(^^U)) {return addressof(extract<const U&>(meta::reflect_constant(std::forward<T>(t))));} else {return define_static_array(span(addressof(t), 1)).data();}

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/meta.tex#L3425)

[*Note [1](#note-1)*:

For class types,define_static_object provides
the address of the template parameter object ([[temp.param]](temp.param "13.2 Template parameters"))
that is template-argument equivalent to t[.](#5.sentence-1)

â *end note*]
