More support in C++, is it comming?

I'd like to see more support functions in C++, like:
* XML support
* Objectify all similar functions like string to number and number to string(formatted also). Would like to find like function all in one place. Like a class with static members instead of spread around different function names.
* More string functions, like StringBetweenStrings etc.

Is there anything new coming in support functions?
C++ grows by volunteer effort.

Someone would have to propose an XML library, likely first to boost, and if it succeeds there, to C++. There aren't any XML library proposals for C++ in flight. There is a library in boost that can read/write most XML (boost.propertytree), but it's only incidental to its purpose. Of non-standard opensource XML libraries, I read good things about http://pugixml.org/

Making string operations static members of some class doesn't make sense in C++. We are getting some new string types (string views) and functions (from_chars/to_chars) in C++17, but not the way you're thinking.

There are many popular string functions in the boost string algo library: http://www.boost.org/doc/libs/release/doc/html/string_algo.html
Last edited on
Cubbi:
"Making string operations static members of some class doesn't make sense in C++."

Why? I mean C++ is object oriented. We should get away from C style loose functions.
Last edited on
iKjetil wrote:
Why? I mean C++ is object oriented. We should get away from C style loose functions.


To quote Stroustrup from https://isocpp.org/blog/2014/12/myths-1
In this three-part series, I will explore, and debunk, five popular myths about C++:
“To understand C++, you must first learn C”
“C++ is an Object-Oriented Language”


The "loose functions" are not C style: they are overloaded, grouped in namespaces, and tied to the classes they represent by argument-dependent lookup. Look at swap for example: http://en.cppreference.com/w/cpp/algorithm/swap#Specializations -- besides the two main overloads, there is one for every non-trivial library class. You don't make something a class member in C++ unless there is no other way.
Last edited on
More information:

How Non-Member Functions Improve Encapsulation

I'll start with the punchline: If you're writing a function that can be implemented as either a member or as a non-friend non-member, you should prefer to implement it as a non-member function. That decision increases class encapsulation. When you think encapsulation, you should think non-member functions.

Surprised? Read on. ...

Scott Meyers in 'DrDobb's', February 2000

http://www.drdobbs.com/cpp/how-non-member-functions-improve-encapsu/184401197?
Topic archived. No new replies allowed.