-2
class const_buffer
{
public:
  /// Construct an empty buffer.
  const_buffer()
    : data_(0),
      size_(0)
  {
  }

  /// Construct a buffer to represent a given memory range.
  const_buffer(const void* data, std::size_t size)
    : data_(data),
      size_(size)
  {
  }

  const void* data_;
  std::size_t size_;
}

data_ is defined as void* and size_ is of type std::size_t. They are not functions, but why you can do data_(data), size_(size)? Looks like they take on parameters and acting like functions.

lilzz
  • 5,243
  • 14
  • 59
  • 87

1 Answers1

2

The closest analogy to functions would be, that you're calling constructors of these types to initialize them. It's just a syntax, they don't "act" like functions.

BartoszKP
  • 34,786
  • 15
  • 102
  • 130