PrevUpHomeNext

esv::delim_base


Everyone devotes himself to science.

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

Esvcpp Delim:

Esvcpp No Delim:

class delim_base final;

esv::delim

esv::delim targets to std::string.

esv::no_delim

esv::u8delim

esv::delim targets to std::u8string.

esv::no_u8delim

esv::u16delim

esv::delim targets to std::u16string.

esv::no_u16delim

esv::u32delim

esv::delim targets to std::u32string.

esv::no_u32delim

esv::wdelim

esv::delim targets to std::wstring.

esv::no_wdelim

Include

#include <esvcpp/core.hpp>

Constructors

delim() = delete;

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

template <esv::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 <esv::kspt::printable PrintableValue>
inline bool operator==(const PrintableValue & value) const;

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

std::string data() const;

esv::no_delim

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

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

How to insert empty delim

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

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

Notice

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

Example

#include <esvcpp/core.hpp>

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

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

	esv::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

esv::print

Esvcpp


PrevUpHomeNext

esv::print