MCPcopy Create free account
hub / github.com/catboost/catboost / TReference

Class TReference

util/generic/bitmap.h:336–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334
335public:
336 class TReference {
337 private:
338 friend class TBitMapOps<TTraits>;
339
340 TChunk* Chunk;
341 size_t Offset;
342
343 TReference(TChunk* c, size_t offset)
344 : Chunk(c)
345 , Offset(offset)
346 {
347 }
348
349 public:
350 ~TReference() = default;
351
352 Y_FORCE_INLINE TReference& operator=(bool val) {
353 if (val) {
354 *Chunk |= static_cast<TChunk>(1) << Offset;
355 } else {
356 *Chunk &= ~(static_cast<TChunk>(1) << Offset);
357 }
358
359 return *this;
360 }
361
362 Y_FORCE_INLINE TReference& operator=(const TReference& ref) {
363 if (ref) {
364 *Chunk |= static_cast<TChunk>(1) << Offset;
365 } else {
366 *Chunk &= ~(static_cast<TChunk>(1) << Offset);
367 }
368
369 return *this;
370 }
371
372 Y_FORCE_INLINE bool operator~() const {
373 return 0 == (*Chunk & (static_cast<TChunk>(1) << Offset));
374 }
375
376 Y_FORCE_INLINE operator bool() const {
377 return 0 != (*Chunk & (static_cast<TChunk>(1) << Offset));
378 }
379
380 Y_FORCE_INLINE TReference& Flip() {
381 *Chunk ^= static_cast<TChunk>(1) << Offset;
382 return *this;
383 }
384 };
385
386private:
387 struct TSetOp {

Callers 1

operator[]Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected