proxygen
AtomicSharedPtrCounted.h File Reference

Go to the source code of this file.

Classes

struct  counted_shared_tag
 
struct  intrusive_shared_count< Atom >
 
struct  counted_ptr_base< Atom >
 
class  counted_ptr< T, Atom >
 
class  counted_ptr_internals< Atom >
 

Functions

template<template< typename > class Atom = std::atomic, typename T , typename... Args>
counted_ptr< T, Atommake_counted (Args &&...args)
 

Function Documentation

template<template< typename > class Atom = std::atomic, typename T , typename... Args>
counted_ptr<T, Atom> make_counted ( Args &&...  args)

Definition at line 104 of file AtomicSharedPtrCounted.h.

References Atom, ptr, and T.

104  {
105  char* mem = (char*)malloc(sizeof(T) + sizeof(intrusive_shared_count<Atom>));
106  if (!mem) {
107  throw std::bad_alloc();
108  }
109  new (mem) intrusive_shared_count<Atom>();
110  T* ptr = (T*)(mem + sizeof(intrusive_shared_count<Atom>));
111  new (ptr) T(std::forward<Args>(args)...);
113 }
void * ptr
#define T(v)
Definition: http_parser.c:233