PrevUpHomeNext

utx::delim_base


utx::delim_base is the base class of utxcpp delim string. It has five template class alias: utx::delim utx::u8delim utx::u16delim utx::u32delim utx::wdelim. Object of utx::delim_base is used for inserting a delim value between two values.

Utxcpp Delim:

Utxcpp No Delim:

class delim_base final;

utx::delim

utx::delim targets to std::string.

utx::no_delim

utx::u8delim

utx::delim targets to std::u8string.

utx::no_u8delim

utx::u16delim

utx::delim targets to std::u16string.

utx::no_u16delim

utx::u32delim

utx::delim targets to std::u32string.

utx::no_u32delim

utx::wdelim

utx::delim targets to std::wstring.

utx::no_wdelim

Include

#include <utxcpp/core.hpp>

Constructors

delim() = delete;

delim(const std::string & a_delim_string) noexcept;

template <utx::kspt::printable PrintableValue>
delim(const PrintableValue & a_delim) noexcept;

delim(const delim & a_delim) noexcept;

Public Members

inline bool operator==(const delim & a_delim) const;

template <utx::kspt::printable PrintableValue>
inline bool operator==(const PrintableValue & value) const;

template <utx::kspt::ostream OutStream>
friend OutStream & operator<<(OutStream & os, const delim & a_delim);

std::string data() const;

utx::no_delim

A constant value which indicates that there should not add a delim between values.

inline const std::string && no_delim = "utx::no_delim";

How to insert empty delim

Empty string "", '' are not accepted by utx::delim, which will throw an exception.

Please use utx::no_delim, if you want to insert an empty delim.

Notice

[Note] Note
  • Accept any printable value to construct an utx::delim object.
  • Accept any printable value to assignment operator.
  • A calling which contains utx::delim argument accepts any printable values.
  • please use utx::no_delim if you want an empty delim; do not use empty string such as "" or '', which will throw an exception.

Example

#include <utxcpp/core.hpp>

int main() {
	utx::print_to(std::cout, utx::delim{'-'}, "I", "have", 3, "apples");
	utx::print();
	utx::print_to(std::cout, '-', "I", "have", 3, "apples");
	utx::print();
/*
Result:
I-have-3-apples
I-have-3-apples
*/

	utx::print_to(std::cout, 777, "It", "is", "too", "small.");
	utx::print();
/*
Result:
It777is777too777small.
*/

	utx::print_to(std::cout, '-', 'I', "have", "no", "idea.", '\n');
/*
Result:
I-have-no-idea.-

(Because there is a delim between "idea." and '\n')
*/
}

See Also

utx::print

Utxcpp


PrevUpHomeNext

utx::print

esv::print