squid-
cache.org
Optimising Web Delivery
Docs
Download
Donate
Support
About
Contact
Shop
Blog
src
ipc
mem
FlexibleArray.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3
*
4
* Squid software is distributed under GPLv2+ license and includes
5
* contributions from numerous individuals and organizations.
6
* Please see the COPYING and CONTRIBUTORS files for details.
7
*/
8
9
#ifndef SQUID_IPC_MEM_FLEXIBLE_ARRAY_H
10
#define SQUID_IPC_MEM_FLEXIBLE_ARRAY_H
11
12
#include <cstddef>
13
#include <new>
14
15
namespace
Ipc
16
{
17
18
namespace
Mem
19
{
20
25
template
<
class
Item>
26
class
FlexibleArray
27
{
28
public
:
29
explicit
FlexibleArray
(
const
int
capacity) {
30
new
(
raw
()) Item[capacity];
31
}
32
33
Item &
operator []
(
const
int
idx) {
return
*(
raw
() + idx); }
34
35
Item *
raw
() {
return
reinterpret_cast<
Item*
>
(&
start_
); }
36
37
private
:
38
alignas
(Item) std::byte
start_
;
39
};
40
41
}
// namespace Mem
42
43
}
// namespace Ipc
44
45
#endif
/* SQUID_IPC_MEM_FLEXIBLE_ARRAY_H */
46
Ipc::Mem::FlexibleArray
Definition:
FlexibleArray.h:27
Ipc::Mem::FlexibleArray::raw
Item * raw()
Definition:
FlexibleArray.h:35
Ipc::Mem::FlexibleArray::operator[]
Item & operator[](const int idx)
Definition:
FlexibleArray.h:33
Ipc::Mem::FlexibleArray::start_
std::byte start_
the first byte of the first array item
Definition:
FlexibleArray.h:38
Ipc::Mem::FlexibleArray::FlexibleArray
FlexibleArray(const int capacity)
Definition:
FlexibleArray.h:29
Ipc
Definition:
IpcIoFile.h:24
Mem
Memory Management.
Definition:
Allocator.h:17
Introduction
About Squid
Why Squid?
Squid Developers
How to Donate
How to Help Out
Getting Squid
Squid Source Packages
Squid Deployment Case-Studies
Squid Software Foundation
Documentation
Quick Setup
Configuration:
Reference
Examples
FAQ
and
Wiki
Guide Books:
Beginners
Definitive
Non-English
More...
Support
Security Advisories
Bugzilla Database
Mailing lists
Contacting us
Commercial services
Project Sponsors
Squid-based products
Miscellaneous
Developer Resources
Related Writings
Related Software:
Authenticators
Ecap
Icap
Ident
Log Analysis
Monitor
Proxies
Redirectors
General
Squid Artwork
Web Site Translations
Japanese
Mirrors
Website:
gr
il
pl
...
full list
FTP Package Archive