|
tgen
|
String value. More...

Public Member Functions | |
| value (const std::string &str) | |
| Creates a string value from a std::string. | |
| int | size () const |
| Returns the size of the string value. | |
| char & | operator[] (int idx) |
| Accesses the character at some position of the string. | |
| value & | sort () |
| Sorts the characters in non-decreasing order. | |
| value & | reverse () |
| Reverses the string. | |
| value & | lowercase () |
| Sets all characters to lowercase. | |
| value & | uppercase () |
| Sets all characters to uppercase. | |
| value | operator+ (const value &rhs) const |
| Concatenates two strings. | |
| value & | shuffle () |
| Shuffles the string. | |
| char | pick () const |
| Returns a uniformly random element. | |
| template<typename Dist> | |
| char | pick_by_distribution (const std::vector< Dist > &distribution) const |
| Returns a random element from the string with given probabilities. | |
| value | choose (int k) const |
| Chooses a uniformly random subsequence of given length. | |
| std::string | to_std () const |
| Converts the string to a std::string. | |
| Public Member Functions inherited from tgen::gen_value_base< value > | |
| bool | operator< (const value &rhs) const |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const value &val) |
| Prints the string to an output stream. | |
|
inline |
Creates a string value from a std::string.
| str | The std::string representing the string. |
|
inline |
Chooses a uniformly random subsequence of given length.
| k | Subsequence length. |
O(n).
|
inline |
Sets all characters to lowercase.
O(n).
Concatenates two strings.
| rhs | The right-hand side. |
Linear.
|
inline |
Accesses the character at some position of the string.
| idx | Index to be accessed. |
|
inline |
Returns a uniformly random element.
O(1).
|
inline |
Returns a random element from the string with given probabilities.
| distribution | Probability distribution. |
O(1).
|
inline |
Reverses the string.
O(n).
|
inline |
Shuffles the string.
O(n).
|
inline |
Returns the size of the string value.
|
inline |
Sorts the characters in non-decreasing order.
O(n log n).
|
inline |
Converts the string to a std::string.
|
inline |
Sets all characters to uppercase.
O(n).
|
friend |